Repository navigation
Add shard label to proxy_request_duration_seconds - #4516
Conversation
|
Hi @AuricX. Thanks for your PR. I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
ntnn
left a comment
There was a problem hiding this comment.
/lgtm
/approve
/ok-to-test
Thank you!
|
LGTM label has been added. DetailsGit tree hash: ad2ae193dd616a696b9df8661ca0fff585dc7232 |
|
/retest |
1 similar comment
|
/retest |
|
This needs rebase now. Please rebase and convert to read. Moving to draft in the meantime |
Signed-off-by: AuricX <auricx.business@gmail.com>
91f035d to
c7659c0
Compare
|
@mjudeikis I rebased onto main, the only conflict came from pkg/proxy/lookup being merged into pkg/server/proxy so ShardNameHolderFrom lives there now and the metrics package imports it from there, tests and lint pass locally. @ntnn the push dropped your lgtm, please take another look when you have some time. |
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: df5575b8ba9ddf326b97565db22a28b5ffe11d6f |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mjudeikis, ntnn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
Adds a
shardlabel toproxy_request_duration_seconds, so front-proxy latency can be split per backend shard, and removes theTODO(csams)inpkg/proxy/metrics/metrics.go.The shard is resolved inside the latency middleware (by
lookup.WithClusterResolver, on a derived context), soWithLatencyTrackingcan't read it from its own request. It now uses the sameShardNameHolderpattern asWithBodyTracking: it stores a holder in the request context before calling the next handler, andpromhttp.WithLabelFromCtxreads the name from it after the handler returns. Requests the front-proxy serves itself (/metrics,/readyz) getshard="".WithShardNameHoldernow returns the existing holder when the context already has one. Otherwise the holder created byWithBodyTrackingwould shadow the latency one and the latency metric would never see the shard name. A smallShardNameHolderFromgetter is added so the metrics package can read the holder.The TODO mentions the shard URL, but the label uses the shard name to match
kcp_backend_rq_body_bytes,kcp_backend_rs_body_bytesandkcp_listener_tls_connection_error. Cardinality grows by the number of shards. The metric is ALPHA, and existing queries that aggregateby (code, method)keep working.TestWithLatencyTrackingwraps a handler in the real middleware order (WithLatencyTracking(WithBodyTracking(...))) and checks one observation lands onshard="shard-1", or onshard=""when no shard is set. It fails without this change because the metric has noshardlabel, and it also fails if the holder isn't reused.What Type of PR Is This?
/kind feature
Related Issue(s)
Part of #4502
Release Notes