metrics: clean up inactive gRPC stream target series#11045
Conversation
Signed-off-by: HunDunDM <hundundm@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughStreaming gRPC metrics now track active label sets and remove histogram labels when the last cleanup-enabled stream closes. RPC handlers defer cleanup callbacks, and tests cover cleanup, shared lifecycles, repeated closes, and persistent legacy metrics. ChangesStream metrics lifecycle
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11045 +/- ##
==========================================
- Coverage 79.25% 79.20% -0.05%
==========================================
Files 541 542 +1
Lines 76037 76148 +111
==========================================
+ Hits 60262 60315 +53
- Misses 11534 11561 +27
- Partials 4241 4272 +31
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@HunDunDM: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
|
Hi @HunDunDM — just a heads-up that #11042 seems to be fixing the same issue (stale Both PRs take a similar approach with refcounting on If you get a chance, mind taking a quick look at that one too? Happy to cross-check both sides — this PR is still on our radar as well 🙏 |
What problem does this PR solve?
gRPC stream metrics retain
targetlabel series after clients disconnect, causing/metricsto grow continuously.Issue Number: Close #11044
What is changed and how does it work?
Track the number of active streams for each
(request, target)label pair and delete the corresponding Histogram series when the last stream exits.Reference counting prevents one connection from deleting metrics still used by another connection from the same target.
Check List
Tests
Release note
Summary by CodeRabbit
Bug Fixes
Monitoring