Fix control plane metrics instrumentation gaps#384
Merged
Conversation
1. Add duckgres_hot_idle_workers gauge — hot-idle workers were invisible to metrics (not counted by observeWarmPoolLifecycleGauges) 2. Add connections_open to control plane — connectionsGauge was only incremented in standalone mode (server.go), not in the control plane's handleConnection. Export Inc/Dec helpers from server pkg. 3. Update org_sessions_active on session create/destroy — was only updated on admin API pull (AllOrgStats), not on every connection. Now incremented after CreateSession and decremented in defer after DestroySession. 4. Add observeOrgSessionsActive stub for non-kubernetes builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
85d425c to
5415d3f
Compare
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.
Summary
Three metrics that showed zero during load testing are now properly instrumented:
duckgres_hot_idle_workers(new gauge) — hot-idle workers were invisible toobserveWarmPoolLifecycleGaugeswhich only counted idle/reserved/activating/hot/drainingduckgres_connections_open— was only incremented in standalone mode (server.go), not in the control plane'shandleConnection. Added exportedIncrementOpenConnections/DecrementOpenConnectionshelpers.duckgres_org_sessions_active— was only updated when the admin API'sAllOrgStats()was called (pull-based). Now updated on everyCreateSession/DestroySessioninhandleConnection.Also adds
observeOrgSessionsActivestub for non-kubernetes builds sincecontrol.gohas no build tag.Test plan
go build .andgo build -tags kubernetes .passgo vetpasses (both tags)/metrics— verify non-zero values🤖 Generated with Claude Code