adapter: remove unused timestamp-difference metrics and their redundant peek work - #38614
adapter: remove unused timestamp-difference metrics and their redundant peek work#38614Alphadelta14 wants to merge 6 commits into
Conversation
The sibling of mz_timestamp_difference_for_strict_serializable_ms, removed for the same reasons. Nothing queries it, and observing it required a second full determine_timestamp_for call, at IsolationLevel::Serializable, on every non-immediate bounded-staleness peek. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
QA LLM Review1. MEDIUM -- bounded-staleness metric is broken, not legacy, and removing it drops the only staleness instrument for a live isolation level
The premise behind the removal ("introduced in 2023 and unused since", "same shape") does not hold for DetailsBoth observation sites were gated on Two consequences worth reflecting in the change: all of the measured cardinality and all of the removed redundant peek work come from the strict-serializable metric alone; and 2. LOW -- bucket comment misstates what
|
There was a problem hiding this comment.
🟡 Changes recommended
The description incorrectly claims the retained bounded-staleness metric and its redundant work are also removed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Removes an unused strict-serializable timestamp metric and its redundant timestamp-selection work, reducing scrape size and peek overhead.
Changes:
- Removes the strict-serializable timestamp-difference metric.
- Eliminates duplicate timestamp determination in both peek paths.
- Drops two low-latency histogram buckets.
File summaries
| File | Description |
|---|---|
src/adapter/src/metrics.rs |
Removes metric registration and narrows histogram buckets. |
src/adapter/src/frontend_peek.rs |
Removes redundant frontend timestamp determination. |
src/adapter/src/coord/timestamp_selection.rs |
Removes redundant coordinator timestamp determination. |
doc/user/data/metrics.yml |
Removes generated metric catalog entries. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| buckets: histogram_seconds_buckets(0.000_128, 32.0) | ||
| // NOTE: This bucket is slightly reduced since measures sub <512us are few and far between. | ||
| // This has a high impact on cardinality otherwise (and is slightly leaky) | ||
| buckets: histogram_seconds_buckets(0.000_512, 32.0) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Motivation
While investigating why one large production environment's
environmentdwasfailing Prometheus scrapes, its
/metricsresponse turned out to be roughly55 MB across ~450k series, and the managed collector was rejecting it outright
with
body size limit exceeded. That environment is a ~6x cardinality outlieragainst every other
environmentdin its region, so it hits the ceiling first,but the underlying growth is not specific to it.
Auditing the response against our monitoring query registry turned up
two metricsonemetric that nothing consumes:
mz_timestamp_difference_for_strict_serializable_ms— ~38,700 series, about4 MB, roughly 7% of that environment's entire scrape response.
mz_timestamp_difference_for_bounded_staleness_ms— same shape, negligiblein that environment only because it barely uses bounded staleness.
No dashboard, alert, or ad-hoc query references the former, under any variant
suffix. It was introduced in 2023 and has gone unused since.
Note that the second was more recently introduced and has not gone through the motions
to be used yet.
Description
Removes both metrics and the code that fed them.
The removal is not only about response size. Both observation sites ran a
second full timestamp determination to produce their value: each one called
determine_timestamp_foragain atIsolationLevel::Serializable, acquiringtemporary read holds, purely to diff against the timestamp already chosen. That
happened on every non-immediate strict-serializable peek and every
non-immediate bounded-staleness peek, in both the coordinator path
(
timestamp_selection.rs) and the frontend peek path (frontend_peek.rs).Deleting the metrics deletes that redundant work from the peek path.
Also narrows the bucket range on
mz_time_to_first_row_secondsfromhistogram_seconds_buckets(0.000_128, 32.0)to(0.000_512, 32.0). Across16.1 million observations in the environment above, the
le=0.000128bucketheld zero and
le=0.000256held twelve: a client round trip does not completein under 512us. This drops 2 of 20 series per label combination with no
information loss and no change for any consumer. The top of the range is
deliberately left alone, because our console query-latency alert fires on a p95
above 10s and needs
le=8/16/32to interpolate across that threshold.Note that this only slows growth of
mz_time_to_first_row_secondsrather thanbounding it. Its
instance_idlabel is unbounded, one value per cluster theprocess has ever served a peek for, and the metric is a plain
HistogramVecrather than a
DeleteOnDropone, so dropped clusters are never reclaimed. Inthe environment above it held 2,459 cluster ids against 433 live clusters.
Fixing that properly means either dropping the label's unbounded dimension or
reclaiming on cluster drop, which is a larger change and deliberately not in
scope here.
The generated metric catalog (
doc/user/data/metrics.yml) is regenerated withbin/gen-metrics-catalog.Verification
No new tests. Both removed metrics were write-only, with no test coverage and
no assertions anywhere in the tree, so there is nothing to update. Verified
that no reference to either metric survives in
src/,test/, ormisc/, andthat
cargo check -p mz-adapter --all-targetsis clean with no warnings afterremoving the
CastLossyimports the deletions orphaned.mz_time_to_first_row_secondskeeps its existing coverage insrc/environmentd/tests/server.rs, which asserts the metric exists and carriesan
application_namelabel. The bucket change does not affect it.Release notes
This release will remove the
mz_timestamp_difference_for_strict_serializable_msmetric, which was listed in the metrics appendix but not intended as a supported surface.
It will also drop two unused low-latency buckets from
mz_time_to_first_row_seconds.🤖 Generated with Claude Code