Skip to content

feat(database_observability.mysql): add database_observability_wait_event_seconds_total counter#6106

Open
gaantunes wants to merge 1 commit intomainfrom
gaantunes/wait-event-prom-counter
Open

feat(database_observability.mysql): add database_observability_wait_event_seconds_total counter#6106
gaantunes wants to merge 1 commit intomainfrom
gaantunes/wait-event-prom-counter

Conversation

@gaantunes
Copy link
Copy Markdown
Contributor

Summary

Adds a database_observability_wait_event_seconds_total Prometheus counter to the MySQL component that pre-aggregates wait time per query digest and database schema.

This counter provides an alternative backend for wide-window TotalWaitEventsTime queries, bypassing the Loki 500-series fallback loop entirely. Benchmarks show −52 to −65% p50 at 1h30+ unfiltered windows where Loki fallback adds 2–7s of retry overhead.

Details

Metric: database_observability_wait_event_seconds_total (counter)
Labels: server_id (curried at component level), digest, schema
Emitted: unconditionally on every wait event row, regardless of which Loki op version is active
Exposed: at the component's /metrics endpoint via the existing registry

server_id is curried at the component level using CounterVec.CurryWith, so the collector only needs digest and schema label values.

Changes

  • waitEventCounter *prometheus.CounterVec field on Component (lifecycle mirrors exporterCollector)
  • Counter creation, registration, and CurryWith in startCollectors
  • WaitEventCounter *prometheus.CounterVec passed to QuerySamples collector
  • Counter increment after each wait event emit
  • TestQuerySamples_WaitEventCounter unit test

Test plan

  • TestQuerySamples_WaitEventCounter passes
  • Counter visible at /metrics on a running instance
  • Labels server_id, digest, schema present on each series

🤖 Generated with Claude Code

…vent_seconds_total counter

Adds a Prometheus counter that pre-aggregates wait time per query digest
and database schema. The counter is emitted unconditionally alongside each
wait event log entry, regardless of which op version is active.

Labels: server_id (curried at component level), digest, schema.
Exposed at the component's /metrics endpoint via the existing registry.
@gaantunes gaantunes requested a review from a team as a code owner April 22, 2026 14:22
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