feat(relay): gate usage metrics behind stable leader#1803
Closed
wpfleger96 wants to merge 2 commits into
Closed
Conversation
Run DB-derived usage rollups on one advisory-lock leader while preserving per-pod in-memory gauges and safely expiring idle series. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Touch event-driven gauges with a value-neutral increment so steady series survive the exporter idle timeout without racing lifecycle deltas. The regression coverage verifies both generation advancement and lifecycle value preservation. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Member
Author
|
Superseded by #1814 — same branch content, rebased onto current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gate database-derived relay usage metrics behind a stable PostgreSQL advisory-lock leader while retaining pod-local live gauges on every pod.
The leader owns a detached physical session, so its advisory lock cannot leak back into the shared SQLx pool or consume a pool slot. It pings that session before each collection; failed liveness demotes it and retries acquisition on the next interval.
USAGE_METRICS_LOCK_KEYand a detachedUsageMetricsLeaderguard.All/Offemission scope.