Skip to content

refactor(metrics): drop active_sessions_total gauge#12

Merged
jaredLunde merged 1 commit into
mainfrom
remove-active-sessions-gauge
Jun 27, 2026
Merged

refactor(metrics): drop active_sessions_total gauge#12
jaredLunde merged 1 commit into
mainfrom
remove-active-sessions-gauge

Conversation

@jaredLunde

Copy link
Copy Markdown
Contributor

What

Removes the active_sessions_gauge background task and its auth_active_sessions_total metric.

Why

The task ran SELECT COUNT(*) FROM auth.sessions ... against Postgres every 60s solely to refresh a capacity-planning gauge. That poll generated continuous TAP traffic on the auth VM and on Postgres, pinning both VMs awake and defeating scale-to-zero for an otherwise idle app. Of the 5 primitive VMs per app, auth + queue + postgres never deep-sleep largely because of polls like this one.

The gauge is non-essential (session counts can be derived from existing auth event counters or an ad-hoc query when needed), so this is a clean removal.

Changes

  • Delete active_sessions_gauge (src/http.rs)
  • Remove its spawn + shutdown-abort wiring (src/cli.rs)
  • Remove the active_sessions_total metric definition (src/metrics.rs)
  • Drop the now-orphaned sqlx offline cache entry

Builds clean (SQLX_OFFLINE=true cargo check); no remaining references anywhere in the repo.

🤖 Generated with Claude Code

The active_sessions_gauge background task ran a `SELECT COUNT(*)` against
Postgres every 60s purely to refresh a capacity-planning gauge. That poll
generated continuous TAP traffic on the auth VM (and on Postgres), pinning
both awake and defeating scale-to-zero for an idle app.

The gauge is non-essential — session counts are derivable from existing
auth event counters when needed — so remove the task, its spawn/abort
wiring, the metric definition, and the now-orphaned sqlx offline cache.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jaredLunde jaredLunde merged commit 50766c4 into main Jun 27, 2026
5 of 6 checks passed
@jaredLunde jaredLunde deleted the remove-active-sessions-gauge branch June 27, 2026 06:35
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