Skip to content

adapter: Add more metrics - #22049

Merged
ParkMyCar merged 2 commits into
MaterializeInc:mainfrom
ParkMyCar:stash/crdb-metrics
Sep 29, 2023
Merged

ParkMyCar merged 2 commits into
MaterializeInc:mainfrom
ParkMyCar:stash/crdb-metrics

Conversation

@ParkMyCar

Copy link
Copy Markdown
Contributor

In response to incident_74 we want to add more metrics around how long it takes us to query CRDB. This PR adds the following metrics:

  1. Histograms for all of the queries the Stash makes.
  2. Histogram for tables writes made by the Coordinator.

It also improves the tagging for the "slow coordinator message" metrics to include the subtype of Command that the coordinator is running.

Motivation

Incident 74

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • This PR includes the following user-facing behavior changes:
    • N/a

…rics to table writes, improve slow message tagging
@ParkMyCar
ParkMyCar requested a review from a team as a code owner September 28, 2023 21:17
Comment thread src/adapter/src/metrics.rs Outdated
var_labels: ["notice_type"],
)),
append_table_seconds: registry.register(metric!(
name: "mz_append_table_seconds",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "mz_append_table_seconds",
name: "mz_append_table_duration_seconds",

Prometheus seems to recommend using duration for this stuff: https://prometheus.io/docs/practices/naming/#metric-names

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, renamed!

Comment thread src/stash/src/postgres.rs
var_labels: ["cause"],
)),
query_latency_seconds: registry.register(metric!(
name: "mz_query_latency",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "mz_query_latency",
name: "mz_query_latency_seconds",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@ParkMyCar
ParkMyCar enabled auto-merge (squash) September 29, 2023 14:10
@ParkMyCar
ParkMyCar merged commit e76c580 into MaterializeInc:main Sep 29, 2023
@ParkMyCar
ParkMyCar deleted the stash/crdb-metrics branch October 16, 2023 18:47
antiguru added a commit to antiguru/materialize that referenced this pull request Aug 26, 2026
Merge each reference's Hazards and Invariants into a single section. The
split produced near-verbatim duplication in every reference, between three
and five entries each, because almost every hazard is an invariant with a
measurement attached. Each entry now leads with the property that holds at
any fleet size and gives the measurement inline.

Correct the compute reference's response queue row. It claimed
mz_compute_controller_response_queue_size exists directly, but no metric!
invocation registers that name and Prometheus carries no such series. The
response channel is an instrumented_unbounded_channel, which takes a send
and a receive counter and exports no depth gauge, so the difference of the
two is the only way to read depth. Record the counter-reset hazard that
follows, since both counters reset when a pod is replaced.

Add scripts/, holding the batched-query builder that step 5 needs and the
panel-query slicer that step 4 refers to.

Guard the references against metric renames from two directions. At run
time, catalog-diff.sh reads doc/user/data/metrics.yml at the release tags on
either side of a sign-off boundary, which separates an empty panel that is a
finding from one that is a metric arriving or departing with the release. At
commit time, ci/test/lint-skill-metrics.sh resolves every mz_* name in the
skill against the catalog, glob patterns included, and fails on any that
neither resolves nor carries a documented exemption in metrics-allowlist.txt.
It also fails on an exemption that has started resolving, so entries cannot
outlive their reason.

Record three dead dashboard panels found while building the lint.
mz_query_latency was added in MaterializeInc#22049 and deleted in MaterializeInc#26647 along with the
stash, and environmentd-health still plots its _bucket family.
mz_persist_columnar_validation_count and mz_txn_placeholder_schema_apply
have never appeared in this repository, yet both are arms of the persist
dashboard's `should be small` panel, so two of its sixteen series are
permanent zeros that make the panel read healthier than it is.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants