Skip to content

Add schema-level MySQL statement and I/O metrics - #186

Draft
Areson wants to merge 2 commits into
mainfrom
ioberst/schema-metrics
Draft

Areson wants to merge 2 commits into
mainfrom
ioberst/schema-metrics

Conversation

@Areson

@Areson Areson commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Blip reports table I/O by table and query counters at server scope. Operators who share one MySQL server cannot compare statement load and table activity by schema without building their own rollups.

What

Add an opt-in stmt.schema domain for statement counts, latency, errors, and row activity grouped by db.
Add group-by: table|schema|both to wait.io.table; the current table output remains the default.

How

The new collector sums selected counters from events_statements_summary_by_digest by SCHEMA_NAME. The I/O collector rolls up table handler counts and wait times by owning schema. It weights averages by event count and excludes empty tables from minimum wait times. Schema sums scan as float64 because MySQL can return values above MaxInt64.

Risk

Both modes are opt-in. Schema statement series omit null-schema and digest catch-all rows, so they can undercount when the digest table fills. group-by: both reads the table I/O summary twice per collection.

Testing

Started the repository's MySQL 8.0.34 Compose service and ran go test -count=1 ./...; all packages passed. The integration tests exercised both collectors, and a regression test passed with a schema sum above MaxInt64. The service was torn down after testing.

Generated with Codex

This branch has not been deployed

No deployments
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