Skip to content

feat(database_observability): add wait_event_v2 op with pre-classified wait_event_type#6105

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

feat(database_observability): add wait_event_v2 op with pre-classified wait_event_type#6105
gaantunes wants to merge 1 commit intomainfrom
gaantunes/wait-event-v2

Conversation

@gaantunes
Copy link
Copy Markdown
Contributor

Summary

Introduces wait_event_v2 as an alternative to the baseline wait_event op for both MySQL and PostgreSQL.

When enable_pre_classified_wait_events = true is set in the query_samples block, Alloy emits wait_event_v2 entries instead of wait_event, with wait_event_type pre-classified at emit time rather than computed via a multi-level label_replace chain at query time.

Classification

MySQL (wait_event_namewait_event_type):

  • wait/io/*IO Wait
  • wait/lock/*, wait/synch/*Lock Wait
  • wait/io/socket/*Network Wait

PostgreSQL (raw wait_event_type → classified wait_event_type):

  • IOIO Wait
  • Lock, LWLock, Activity, Extension, InjectionPoint, IPC, Timeout, BufferPinLock Wait
  • ClientNetwork Wait
  • default → Other Wait

Why

Pre-classifying at emit time eliminates the Loki 500-series fallback retry loop that causes 2–7s tail latency at wide unfiltered windows. Benchmark results: −83 to −90% p95 on WaitEventsPanel duration queries.

Changes

  • wait_event_v2 op added (MySQL + Postgres)
  • enable_pre_classified_wait_events flag in query_samples block (both components)
  • Mutual exclusion: flag ON → v2 only, flag OFF → v1 only
  • classifyMySQLWaitEventType / classifyPostgresWaitEventType with unit tests
  • Docs updated

Test plan

  • Unit tests pass (TestQuerySamples_WaitEvents_PreClassified, TestClassifyMySQLWaitEventType, TestClassifyPostgresWaitEventType)
  • With flag OFF: only wait_event entries in Loki
  • With flag ON: only wait_event_v2 entries with pre-classified wait_event_type

🤖 Generated with Claude Code

…d wait_event_type

Introduces wait_event_v2 as an alternative to the baseline wait_event op.
When enable_pre_classified_wait_events is set in the query_samples block,
Alloy emits wait_event_v2 instead of wait_event, with wait_event_type
pre-classified at emit time (IO Wait / Lock Wait / Network Wait / Other Wait)
rather than computed via label_replace at query time.

MySQL classification: wait/io/* -> IO Wait, wait/lock/* -> Lock Wait,
wait/synch/* -> Synch Wait.

Postgres classification: IO -> IO Wait, Lock/LWLock/... -> Lock Wait,
Client -> Network Wait, default -> Other Wait.
@gaantunes gaantunes requested review from a team and clayton-cornell as code owners April 22, 2026 14:22
@github-actions
Copy link
Copy Markdown
Contributor

💻 Deploy preview available (feat(database_observability): add wait_event_v2 op with pre-classified wait_event_type):

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