Skip to content

Commit

Permalink
kvserver: preinitialize some Pebble category stats
Browse files Browse the repository at this point in the history
This change fixes non-determinism when generating `metrics.html` due
to the Pebble category stats.

Informs #133507
Unblocks #133409

Epic: none
Release note: None
  • Loading branch information
RaduBerinde committed Oct 26, 2024
1 parent 5e1ce54 commit 7a7e3f9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/generated/metrics/metrics.html
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,24 @@
<tr><td>STORAGE</td><td>storage.iterator.block-load.bytes</td><td>Bytes loaded by storage engine iterators (possibly cached). See storage.AggregatedIteratorStats for details.</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.block-load.cached-bytes</td><td>Bytes loaded by storage engine iterators from the block cache. See storage.AggregatedIteratorStats for details.</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.block-load.read-duration</td><td>Cumulative time storage engine iterators spent loading blocks from durable storage. See storage.AggregatedIteratorStats for details.</td><td>Nanoseconds</td><td>COUNTER</td><td>NANOSECONDS</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-batch-eval.block-load.bytes</td><td>Bytes loaded by storage sstable iterators (possibly cached).</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-batch-eval.block-load.cached-bytes</td><td>Bytes loaded by storage sstable iterators from the block cache</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-batch-eval.block-load.latency-sum</td><td>Cumulative latency for loading bytes not in the block cache, by storage sstable iterators</td><td>Latency</td><td>COUNTER</td><td>NANOSECONDS</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-crdb-unknown.block-load.bytes</td><td>Bytes loaded by storage sstable iterators (possibly cached).</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-crdb-unknown.block-load.cached-bytes</td><td>Bytes loaded by storage sstable iterators from the block cache</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-crdb-unknown.block-load.latency-sum</td><td>Cumulative latency for loading bytes not in the block cache, by storage sstable iterators</td><td>Latency</td><td>COUNTER</td><td>NANOSECONDS</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-mvcc-gc.block-load.bytes</td><td>Bytes loaded by storage sstable iterators (possibly cached).</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-mvcc-gc.block-load.cached-bytes</td><td>Bytes loaded by storage sstable iterators from the block cache</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-mvcc-gc.block-load.latency-sum</td><td>Cumulative latency for loading bytes not in the block cache, by storage sstable iterators</td><td>Latency</td><td>COUNTER</td><td>NANOSECONDS</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-rangefeed.block-load.bytes</td><td>Bytes loaded by storage sstable iterators (possibly cached).</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-rangefeed.block-load.cached-bytes</td><td>Bytes loaded by storage sstable iterators from the block cache</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-rangefeed.block-load.latency-sum</td><td>Cumulative latency for loading bytes not in the block cache, by storage sstable iterators</td><td>Latency</td><td>COUNTER</td><td>NANOSECONDS</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-replication.block-load.bytes</td><td>Bytes loaded by storage sstable iterators (possibly cached).</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-replication.block-load.cached-bytes</td><td>Bytes loaded by storage sstable iterators from the block cache</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-replication.block-load.latency-sum</td><td>Cumulative latency for loading bytes not in the block cache, by storage sstable iterators</td><td>Latency</td><td>COUNTER</td><td>NANOSECONDS</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-scan-regular.block-load.bytes</td><td>Bytes loaded by storage sstable iterators (possibly cached).</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-scan-regular.block-load.cached-bytes</td><td>Bytes loaded by storage sstable iterators from the block cache</td><td>Bytes</td><td>COUNTER</td><td>BYTES</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.category-scan-regular.block-load.latency-sum</td><td>Cumulative latency for loading bytes not in the block cache, by storage sstable iterators</td><td>Latency</td><td>COUNTER</td><td>NANOSECONDS</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.external.seeks</td><td>Cumulative count of seeks performed on storage engine iterators. See storage.AggregatedIteratorStats for details.</td><td>Iterator Ops</td><td>COUNTER</td><td>COUNT</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.external.steps</td><td>Cumulative count of steps performed on storage engine iterators. See storage.AggregatedIteratorStats for details.</td><td>Iterator Ops</td><td>COUNTER</td><td>COUNT</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
<tr><td>STORAGE</td><td>storage.iterator.internal.seeks</td><td>Cumulative count of seeks performed internally within storage engine iterators.<br/><br/>A value high relative to &#39;storage.iterator.external.seeks&#39;<br/>is a good indication that there&#39;s an accumulation of garbage<br/>internally within the storage engine.<br/><br/>See storage.AggregatedIteratorStats for details.</td><td>Iterator Ops</td><td>COUNTER</td><td>COUNT</td><td>AVG</td><td>NON_NEGATIVE_DERIVATIVE</td></tr>
Expand Down
11 changes: 11 additions & 0 deletions pkg/kv/kvserver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3753,6 +3753,17 @@ func newStoreMetrics(histogramWindow time.Duration) *StoreMetrics {

storeRegistry.AddMetricStruct(sm)
storeRegistry.AddMetricStruct(sm.LoadSplitterMetrics)

// Pre-initialize some category stats, so that metrics generation is
// deterministic.
// TODO(radu): #133507 tracks fixing this properly.
for _, category := range []sstable.Category{
"batch-eval", "crdb-unknown", "mvcc-gc", "rangefeed",
"replication", "scan-regular"} {
cm := makePebbleCategorizedIterMetrics(category)
sm.categoryIterMetrics.metricsMap.Store(category, cm)
storeRegistry.AddMetricStruct(cm)
}
return sm
}

Expand Down

0 comments on commit 7a7e3f9

Please sign in to comment.