Skip to content

Commit 1e8517f

Browse files
authored
feat: timed function for metrics (#1228)
1 parent f127004 commit 1e8517f

10 files changed

+160
-229
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ tower = "=0.4.13"
8484

8585
# observability
8686
console-subscriber = "=0.2.0"
87-
metrics = { version = "=0.23.0", optional = true }
87+
metrics = "=0.23.0"
8888
metrics-exporter-prometheus = { version = "=0.15.0", optional = true }
8989
opentelemetry = "=0.23.0"
9090
opentelemetry_sdk = { version = "=0.23.0", features = ["rt-tokio"] }
@@ -187,7 +187,7 @@ default = ["bg-threads", "metrics", "tracing", "rocks"]
187187
dev = []
188188

189189
# Enable runtime metrics collection.
190-
metrics = ["dep:metrics", "dep:metrics-exporter-prometheus"]
190+
metrics = ["dep:metrics-exporter-prometheus"]
191191

192192
# Enable runtime tracing/spans collection.
193193
tracing = []

src/eth/primitives/storage_point_in_time.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::eth::primitives::BlockNumber;
2-
#[cfg(feature = "metrics")]
32
use crate::infra::metrics::MetricLabelValue;
43

54
/// EVM storage point-in-time indicator.
@@ -18,7 +17,6 @@ pub enum StoragePointInTime {
1817
// -----------------------------------------------------------------------------
1918
// Conversions: Self -> Other
2019
// -----------------------------------------------------------------------------
21-
#[cfg(feature = "metrics")]
2220
impl From<&StoragePointInTime> for MetricLabelValue {
2321
fn from(value: &StoragePointInTime) -> Self {
2422
match value {

src/eth/storage/rocks/rocks_config.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ impl DbConfig {
3333

3434
// NOTE: As per the rocks db wiki: "The overhead of statistics is usually small but non-negligible. We usually observe an overhead of 5%-10%."
3535
#[cfg(feature = "metrics")]
36-
opts.enable_statistics();
37-
#[cfg(feature = "metrics")]
38-
opts.set_statistics_level(rocksdb::statistics::StatsLevel::ExceptTimeForMutex);
36+
{
37+
opts.enable_statistics();
38+
opts.set_statistics_level(rocksdb::statistics::StatsLevel::ExceptTimeForMutex);
39+
}
3940

4041
match self {
4142
DbConfig::LargeSSTFiles => {

0 commit comments

Comments
 (0)