cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.06k stars 3.8k forks source link

storage: pebble category metrics are initialized too late #133507

Open RaduBerinde opened 6 hours ago

RaduBerinde commented 6 hours ago

We initialize the Pebble category stats lazily here: https://github.com/cockroachdb/cockroach/blob/master/pkg/kv/kvserver/metrics.go#L4142

This is not a supported pattern. It interacts badly with the metrics.html generation (which uses cockroach gen metric-list), resulting in non-deterministic results.

This issue tracks fixing this. We should replace the category string with an enum value. Pebble can export a RegisterCategory("name") that we can call from init code. Then newStoreMetrics can enumerate all the categories. This will also get rid of pebbleCategoryIterMetricsContainer.metricsMap (we can use a simple immutable array).

Jira issue: CRDB-43648

blathers-crl[bot] commented 6 hours ago

Hi @RaduBerinde, please add branch-* labels to identify which branch(es) this C-bug affects.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.