Skip to content

Commit c12dd1c

Browse files
committed
Split hdiff metrics by hot/cold
1 parent 1096565 commit c12dd1c

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

beacon_node/store/src/historic_state_cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ impl<E: EthSpec> HistoricStateCache<E> {
3434

3535
pub fn get_hdiff_buffer(&mut self, slot: Slot) -> Option<HDiffBuffer> {
3636
if let Some(buffer_ref) = self.hdiff_buffers.get(&slot) {
37-
let _timer = metrics::start_timer(&metrics::BEACON_HDIFF_BUFFER_CLONE_TIMES);
37+
let _timer = metrics::start_timer(&metrics::BEACON_COLD_HDIFF_BUFFER_CLONE_TIMES);
3838
Some(buffer_ref.clone())
3939
} else if let Some(state) = self.states.get(&slot) {
4040
let buffer = HDiffBuffer::from_state(state.clone());
41-
let _timer = metrics::start_timer(&metrics::BEACON_HDIFF_BUFFER_CLONE_TIMES);
41+
let _timer = metrics::start_timer(&metrics::BEACON_COLD_HDIFF_BUFFER_CLONE_TIMES);
4242
let cloned = buffer.clone();
4343
drop(_timer);
4444
self.hdiff_buffers.put(slot, cloned);

beacon_node/store/src/hot_cold_store.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,13 +1711,13 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
17111711

17121712
fn load_hot_hdiff(&self, state_root: Hash256) -> Result<HDiff, Error> {
17131713
let bytes = {
1714-
let _t = metrics::start_timer(&metrics::BEACON_HDIFF_READ_TIMES);
1714+
let _t = metrics::start_timer(&metrics::BEACON_HOT_HDIFF_READ_TIMES);
17151715
self.hot_db
17161716
.get_bytes(DBColumn::BeaconStateHotDiff, state_root.as_slice())?
17171717
.ok_or(HotColdDBError::MissingHotHDiff(state_root))?
17181718
};
17191719
let hdiff = {
1720-
let _t = metrics::start_timer(&metrics::BEACON_HDIFF_DECODE_TIMES);
1720+
let _t = metrics::start_timer(&metrics::BEACON_HOT_HDIFF_DECODE_TIMES);
17211721
HDiff::from_ssz_bytes(&bytes)?
17221722
};
17231723
Ok(hdiff)
@@ -2165,13 +2165,13 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
21652165

21662166
fn load_hdiff_for_slot(&self, slot: Slot) -> Result<HDiff, Error> {
21672167
let bytes = {
2168-
let _t = metrics::start_timer(&metrics::BEACON_HDIFF_READ_TIMES);
2168+
let _t = metrics::start_timer(&metrics::BEACON_COLD_HDIFF_READ_TIMES);
21692169
self.cold_db
21702170
.get_bytes(DBColumn::BeaconStateDiff, &slot.as_u64().to_be_bytes())?
21712171
.ok_or(HotColdDBError::MissingHDiff(slot))?
21722172
};
21732173
let hdiff = {
2174-
let _t = metrics::start_timer(&metrics::BEACON_HDIFF_DECODE_TIMES);
2174+
let _t = metrics::start_timer(&metrics::BEACON_COLD_HDIFF_DECODE_TIMES);
21752175
HDiff::from_ssz_bytes(&bytes)?
21762176
};
21772177
Ok(hdiff)

beacon_node/store/src/metrics.rs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,24 +142,38 @@ pub static BEACON_STATE_HOT_GET_COUNT: LazyLock<Result<IntCounter>> = LazyLock::
142142
"Total number of hot beacon states requested from the store (cache or DB)",
143143
)
144144
});
145-
pub static BEACON_HDIFF_READ_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
145+
pub static BEACON_HOT_HDIFF_READ_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
146146
try_create_histogram(
147-
"store_hdiff_read_seconds",
148-
"Time required to read the hierarchical diff bytes from the database",
147+
"store_hot_hdiff_read_seconds",
148+
"Time required to read hierarchical diff bytes from the hot database",
149149
)
150150
});
151-
pub static BEACON_HDIFF_DECODE_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
151+
pub static BEACON_HOT_HDIFF_DECODE_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
152152
try_create_histogram(
153-
"store_hdiff_decode_seconds",
154-
"Time required to decode hierarchical diff bytes",
153+
"store_hot_hdiff_decode_seconds",
154+
"Time required to decode hierarchical diff bytes from the hot database",
155155
)
156156
});
157-
pub static BEACON_HDIFF_BUFFER_CLONE_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
157+
pub static BEACON_COLD_HDIFF_READ_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
158158
try_create_histogram(
159-
"store_hdiff_buffer_clone_seconds",
160-
"Time required to clone hierarchical diff buffer bytes",
159+
"store_cold_hdiff_read_seconds",
160+
"Time required to read the hierarchical diff bytes from the database",
161161
)
162162
});
163+
pub static BEACON_COLD_HDIFF_DECODE_TIMES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
164+
try_create_histogram(
165+
"store_cold_hdiff_decode_seconds",
166+
"Time required to decode hierarchical diff bytes",
167+
)
168+
});
169+
pub static BEACON_COLD_HDIFF_BUFFER_CLONE_TIMES: LazyLock<Result<Histogram>> =
170+
LazyLock::new(|| {
171+
try_create_histogram(
172+
"store_cold_hdiff_buffer_clone_seconds",
173+
"Time required to clone hierarchical diff buffer bytes",
174+
)
175+
});
176+
// This metric is not split hot/cold because it is recorded in a place where that info is not known.
163177
pub static BEACON_HDIFF_BUFFER_APPLY_RESIZES: LazyLock<Result<Histogram>> = LazyLock::new(|| {
164178
try_create_histogram_with_buckets(
165179
"store_hdiff_buffer_apply_resizes",

0 commit comments

Comments
 (0)