Skip to content

Fix control plane metrics instrumentation gaps#384

Merged
EDsCODE merged 1 commit intomainfrom
eric/fix-controlplane-metrics
Apr 1, 2026
Merged

Fix control plane metrics instrumentation gaps#384
EDsCODE merged 1 commit intomainfrom
eric/fix-controlplane-metrics

Conversation

@EDsCODE
Copy link
Copy Markdown
Contributor

@EDsCODE EDsCODE commented Apr 1, 2026

Summary

Three metrics that showed zero during load testing are now properly instrumented:

  1. duckgres_hot_idle_workers (new gauge) — hot-idle workers were invisible to observeWarmPoolLifecycleGauges which only counted idle/reserved/activating/hot/draining

  2. duckgres_connections_open — was only incremented in standalone mode (server.go), not in the control plane's handleConnection. Added exported IncrementOpenConnections / DecrementOpenConnections helpers.

  3. duckgres_org_sessions_active — was only updated when the admin API's AllOrgStats() was called (pull-based). Now updated on every CreateSession / DestroySession in handleConnection.

Also adds observeOrgSessionsActive stub for non-kubernetes builds since control.go has no build tag.

Test plan

  • go build . and go build -tags kubernetes . pass
  • go vet passes (both tags)
  • All tests pass
  • Deploy, run queries, scrape /metrics — verify non-zero values

🤖 Generated with Claude Code

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>
@EDsCODE EDsCODE force-pushed the eric/fix-controlplane-metrics branch from 85d425c to 5415d3f Compare April 1, 2026 20:02
@EDsCODE EDsCODE merged commit aab475e into main Apr 1, 2026
21 checks passed
@EDsCODE EDsCODE deleted the eric/fix-controlplane-metrics branch April 1, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant