chore: update crates.io publish plan and fix dependencies
- Update CRATES_PUBLISH_PLAN.md with Level 0-2 completion status - Fix binary-merkle-tree and related dependencies - Add runtime_logger_tests.rs - Update various Cargo.toml files
This commit is contained in:
@@ -33,9 +33,6 @@ pezsp-version = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
thiserror = { optional = true, workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
pezsp-test-primitives = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
@@ -50,7 +47,6 @@ std = [
|
||||
"pezsp-runtime-interface/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-test-primitives/std",
|
||||
"pezsp-trie/std",
|
||||
"pezsp-version/std",
|
||||
"scale-info/std",
|
||||
@@ -71,7 +67,6 @@ runtime-benchmarks = [
|
||||
"pezsp-runtime-interface/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-state-machine?/runtime-benchmarks",
|
||||
"pezsp-test-primitives/runtime-benchmarks",
|
||||
"pezsp-trie?/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -24,9 +24,6 @@ pezsp-runtime = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
serde = { features = ["alloc", "derive"], optional = true, workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
bizinikiwi-test-utils = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
bench = []
|
||||
|
||||
@@ -32,9 +32,6 @@ static_assertions = { workspace = true, default-features = true }
|
||||
polkavm-derive = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
pezsp-io = { workspace = true, default-features = true }
|
||||
pezsp-runtime-interface-test-wasm = { workspace = true }
|
||||
pezsp-state-machine = { workspace = true, default-features = true }
|
||||
rustversion = { workspace = true }
|
||||
trybuild = { workspace = true }
|
||||
|
||||
@@ -44,9 +41,6 @@ std = [
|
||||
"bytes/std",
|
||||
"codec/std",
|
||||
"pezsp-externalities/std",
|
||||
"pezsp-io/std",
|
||||
"pezsp-runtime-interface-test-wasm/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-std/std",
|
||||
"pezsp-storage/std",
|
||||
"pezsp-tracing/std",
|
||||
@@ -60,7 +54,4 @@ std = [
|
||||
# Disables static assertions in `impls.rs` that checks the word size. To prevent any footgun, the
|
||||
# check is changed into a runtime check.
|
||||
disable_target_static_assertions = []
|
||||
runtime-benchmarks = [
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-state-machine/runtime-benchmarks",
|
||||
]
|
||||
runtime-benchmarks = []
|
||||
|
||||
@@ -9,6 +9,13 @@ repository.workspace = true
|
||||
description = "Runtime Modules shared primitive types."
|
||||
documentation.workspace = true
|
||||
readme = "README.md"
|
||||
exclude = [
|
||||
"docs/images/*.png",
|
||||
"docs/images/*.jpg",
|
||||
"docs/whitepaper/*.png",
|
||||
"!docs/images/Pezkuwi_Logo_Horizontal_Pink_White.png",
|
||||
"!docs/images/Pezkuwi_Logo_Horizontal_Pink_Black.png",
|
||||
]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -17,7 +24,7 @@ workspace = true
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
binary-merkle-tree = { workspace = true }
|
||||
pez-binary-merkle-tree = { workspace = true }
|
||||
bytes = { workspace = true }
|
||||
codec = { features = ["derive", "max-encoded-len"], workspace = true }
|
||||
docify = { workspace = true }
|
||||
@@ -43,8 +50,6 @@ simple-mermaid = { workspace = true, optional = true }
|
||||
tuplex = { workspace = true, default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
bizinikiwi-test-runtime-client = { workspace = true }
|
||||
pezsp-api = { workspace = true, default-features = true }
|
||||
pezsp-state-machine = { workspace = true, default-features = true }
|
||||
pezsp-tracing = { workspace = true, default-features = true }
|
||||
rand = { workspace = true, default-features = true }
|
||||
@@ -53,9 +58,6 @@ zstd = { workspace = true }
|
||||
|
||||
[features]
|
||||
runtime-benchmarks = [
|
||||
"binary-merkle-tree/runtime-benchmarks",
|
||||
"bizinikiwi-test-runtime-client/runtime-benchmarks",
|
||||
"pezsp-api/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-state-machine/runtime-benchmarks",
|
||||
"pezsp-trie/runtime-benchmarks",
|
||||
@@ -63,7 +65,7 @@ runtime-benchmarks = [
|
||||
try-runtime = []
|
||||
default = ["std"]
|
||||
std = [
|
||||
"binary-merkle-tree/std",
|
||||
"pez-binary-merkle-tree/std",
|
||||
"bytes/std",
|
||||
"codec/std",
|
||||
"either/std",
|
||||
@@ -71,7 +73,6 @@ std = [
|
||||
"hash256-std-hasher/std",
|
||||
"log/std",
|
||||
"num-traits/std",
|
||||
"pezsp-api/std",
|
||||
"pezsp-application-crypto/std",
|
||||
"pezsp-arithmetic/std",
|
||||
"pezsp-core/std",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
use super::{ProofToHashes, ProvingTrie, TrieError};
|
||||
use crate::{Decode, DispatchError, Encode};
|
||||
use alloc::{collections::BTreeMap, vec::Vec};
|
||||
use binary_merkle_tree::{merkle_proof, merkle_root, MerkleProof};
|
||||
use pez_binary_merkle_tree::{merkle_proof, merkle_root, MerkleProof};
|
||||
use codec::MaxEncodedLen;
|
||||
|
||||
/// A helper structure for building a basic base-2 merkle trie and creating compact proofs for that
|
||||
@@ -143,7 +143,7 @@ where
|
||||
return Err(TrieError::ValueMismatch.into());
|
||||
}
|
||||
|
||||
if binary_merkle_tree::verify_proof::<Hashing, _, _>(
|
||||
if pez_binary_merkle_tree::verify_proof::<Hashing, _, _>(
|
||||
&decoded_proof.root,
|
||||
decoded_proof.proof,
|
||||
decoded_proof.number_of_leaves,
|
||||
|
||||
@@ -62,40 +62,3 @@ impl log::Log for RuntimeLogger {
|
||||
|
||||
fn flush(&self) {}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use bizinikiwi_test_runtime_client::{
|
||||
runtime::TestAPI, DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
|
||||
};
|
||||
use pezsp_api::ProvideRuntimeApi;
|
||||
use std::env;
|
||||
|
||||
#[test]
|
||||
fn ensure_runtime_logger_works() {
|
||||
if env::var("RUN_TEST").is_ok() {
|
||||
pezsp_tracing::try_init_simple();
|
||||
|
||||
let client = TestClientBuilder::new().build();
|
||||
let runtime_api = client.runtime_api();
|
||||
runtime_api
|
||||
.do_trace_log(client.chain_info().genesis_hash)
|
||||
.expect("Logging should not fail");
|
||||
} else {
|
||||
for (level, should_print) in &[("test=trace", true), ("info", false)] {
|
||||
let executable = std::env::current_exe().unwrap();
|
||||
let output = std::process::Command::new(executable)
|
||||
.env("RUN_TEST", "1")
|
||||
.env("RUST_LOG", level)
|
||||
.args(&["--nocapture", "ensure_runtime_logger_works"])
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
let output = String::from_utf8(output.stderr).unwrap();
|
||||
assert!(output.contains("Hey I'm runtime") == *should_print);
|
||||
assert!(output.contains("THIS IS TRACING") == *should_print);
|
||||
assert!(output.contains("Hey, I'm tracing") == *should_print);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ trie-db = { workspace = true }
|
||||
arbitrary = { features = ["derive"], workspace = true }
|
||||
array-bytes = { workspace = true, default-features = true }
|
||||
assert_matches = { workspace = true }
|
||||
pezsp-runtime = { workspace = true, default-features = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
rand = { workspace = true, default-features = true }
|
||||
|
||||
@@ -51,7 +50,6 @@ std = [
|
||||
"pezsp-core/std",
|
||||
"pezsp-externalities/std",
|
||||
"pezsp-panic-handler",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-trie/std",
|
||||
"rand",
|
||||
"thiserror",
|
||||
@@ -59,6 +57,5 @@ std = [
|
||||
"trie-db/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-trie/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -25,7 +25,7 @@ use codec::Encode;
|
||||
use hash_db::Hasher;
|
||||
use pezsp_core::{storage::StateVersion, traits::Externalities};
|
||||
#[cfg(test)]
|
||||
use pezsp_runtime::traits::BlakeTwo256;
|
||||
use pezsp_core::Blake2Hasher as BlakeTwo256;
|
||||
use pezsp_trie::PrefixedMemoryDB;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::backend::{AsTrieBackend, Backend};
|
||||
use pezsp_core::storage::StateVersion;
|
||||
use pezsp_runtime::traits::BlakeTwo256;
|
||||
use pezsp_core::Blake2Hasher as BlakeTwo256;
|
||||
|
||||
/// Assert in memory backend with only child trie keys works as trie backend.
|
||||
#[test]
|
||||
|
||||
@@ -1103,7 +1103,7 @@ mod tests {
|
||||
traits::{CallContext, CodeExecutor, Externalities, RuntimeCode},
|
||||
H256,
|
||||
};
|
||||
use pezsp_runtime::traits::BlakeTwo256;
|
||||
use pezsp_core::Blake2Hasher as BlakeTwo256;
|
||||
use pezsp_trie::{
|
||||
trie_types::{TrieDBMutBuilderV0, TrieDBMutBuilderV1},
|
||||
KeySpacedDBMut, PrefixedMemoryDB,
|
||||
|
||||
@@ -416,7 +416,7 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pezsp_core::{storage::ChildInfo, traits::Externalities, H256};
|
||||
use pezsp_runtime::traits::BlakeTwo256;
|
||||
use pezsp_core::Blake2Hasher as BlakeTwo256;
|
||||
|
||||
#[test]
|
||||
fn commit_should_work() {
|
||||
|
||||
@@ -578,7 +578,7 @@ pub mod tests {
|
||||
use super::*;
|
||||
use codec::Encode;
|
||||
use pezsp_core::H256;
|
||||
use pezsp_runtime::traits::BlakeTwo256;
|
||||
use pezsp_core::Blake2Hasher as BlakeTwo256;
|
||||
use pezsp_trie::{
|
||||
cache::{CacheSize, SharedTrieCache},
|
||||
trie_types::{TrieDBBuilder, TrieDBMutBuilderV0, TrieDBMutBuilderV1},
|
||||
|
||||
@@ -31,7 +31,6 @@ nohash-hasher = { optional = true, workspace = true }
|
||||
parking_lot = { optional = true, workspace = true, default-features = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-externalities = { workspace = true }
|
||||
prometheus-endpoint = { optional = true, workspace = true, default-features = true }
|
||||
rand = { optional = true, workspace = true, default-features = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
schnellru = { optional = true, workspace = true }
|
||||
@@ -43,7 +42,7 @@ trie-root = { workspace = true }
|
||||
[dev-dependencies]
|
||||
array-bytes = { workspace = true, default-features = true }
|
||||
criterion = { workspace = true, default-features = true }
|
||||
pezsp-runtime = { workspace = true, default-features = true }
|
||||
pezsp-core = { workspace = true, default-features = true }
|
||||
trie-bench = { workspace = true }
|
||||
trie-standardmap = { workspace = true }
|
||||
|
||||
@@ -59,8 +58,6 @@ std = [
|
||||
"parking_lot",
|
||||
"pezsp-core/std",
|
||||
"pezsp-externalities/std",
|
||||
"pezsp-runtime/std",
|
||||
"prometheus-endpoint",
|
||||
"rand",
|
||||
"scale-info/std",
|
||||
"schnellru",
|
||||
@@ -69,4 +66,4 @@ std = [
|
||||
"trie-db/std",
|
||||
"trie-root/std",
|
||||
]
|
||||
runtime-benchmarks = ["pezsp-runtime/runtime-benchmarks"]
|
||||
runtime-benchmarks = []
|
||||
|
||||
@@ -21,11 +21,11 @@ criterion_main!(benches);
|
||||
|
||||
fn benchmark(c: &mut Criterion) {
|
||||
trie_bench::standard_benchmark::<
|
||||
pezsp_trie::LayoutV1<pezsp_runtime::traits::BlakeTwo256>,
|
||||
pezsp_trie::LayoutV1<pezsp_core::Blake2Hasher>,
|
||||
pezsp_trie::TrieStream,
|
||||
>(c, "bizinikiwi-blake2");
|
||||
trie_bench::standard_benchmark::<
|
||||
pezsp_trie::LayoutV1<pezsp_runtime::traits::BlakeTwo256>,
|
||||
pezsp_trie::LayoutV1<pezsp_core::KeccakHasher>,
|
||||
pezsp_trie::TrieStream,
|
||||
>(c, "bizinikiwi-keccak");
|
||||
}
|
||||
|
||||
+43
-192
@@ -17,212 +17,63 @@
|
||||
|
||||
//! Metrics for the trie cache.
|
||||
|
||||
use prometheus_endpoint::{
|
||||
exponential_buckets,
|
||||
prometheus::{core::Collector, HistogramTimer},
|
||||
CounterVec, GaugeVec, HistogramOpts, HistogramVec, Opts, PrometheusError, Registry, U64,
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
pub use prometheus_impl::*;
|
||||
|
||||
// Register a metric with the given registry.
|
||||
fn register<T: Clone + Collector + 'static>(
|
||||
metric: T,
|
||||
registry: &Registry,
|
||||
) -> Result<T, PrometheusError> {
|
||||
registry.register(Box::new(metric.clone()))?;
|
||||
Ok(metric)
|
||||
}
|
||||
#[cfg(feature = "std")]
|
||||
mod prometheus_impl {
|
||||
use super::TrieHitStatsSnapshot;
|
||||
|
||||
/// Metrics for the trie cache.
|
||||
/// This struct is used to track the performance of the trie cache.
|
||||
/// It contains histograms and counters for the shared and local caches.
|
||||
#[derive(Clone)]
|
||||
pub struct Metrics {
|
||||
// The duration in seconds to update the shared trie caches from local to shared cache.
|
||||
shared_update_duration: HistogramVec,
|
||||
// Number of attempts hitting the shared trie caches.
|
||||
shared_hits: CounterVec<U64>,
|
||||
// Number of attempts to the shared trie caches.
|
||||
shared_fetch_attempts: CounterVec<U64>,
|
||||
// Number of attempts hitting the local trie caches.
|
||||
local_hits: CounterVec<U64>,
|
||||
// Number of attempts to the local caches.
|
||||
local_fetch_attempts: CounterVec<U64>,
|
||||
// Length of the local caches.
|
||||
local_cache_lengths: HistogramVec,
|
||||
// The inline size of the shared caches.
|
||||
shared_cache_inline_size: GaugeVec<U64>,
|
||||
// The heap size of the shared caches.
|
||||
shared_cache_heap_size: GaugeVec<U64>,
|
||||
}
|
||||
/// Metrics for the trie cache - stub implementation when prometheus is disabled.
|
||||
#[derive(Clone)]
|
||||
pub struct Metrics;
|
||||
|
||||
impl Metrics {
|
||||
/// Create a new instance of the metrics.
|
||||
pub(crate) fn register(registry: &Registry) -> Result<Self, PrometheusError> {
|
||||
Ok(Self {
|
||||
shared_update_duration: register(
|
||||
HistogramVec::new(
|
||||
HistogramOpts {
|
||||
common_opts: Opts::new(
|
||||
"trie_cache_shared_update_duration",
|
||||
"Duration in seconds to update the shared trie caches from local cache to shared cache",
|
||||
),
|
||||
buckets: exponential_buckets(0.001, 4.0, 9)
|
||||
.expect("function parameters are constant and always valid; qed"),
|
||||
},
|
||||
&["cache_type"], // node or value
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
shared_hits: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"trie_cache_shared_hits",
|
||||
"Number of attempts hitting the shared trie cache",
|
||||
),
|
||||
&["cache_type"], // node or value
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
shared_fetch_attempts: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"trie_cache_shared_fetch_attempts",
|
||||
"Number of attempts to the shared trie cache",
|
||||
),
|
||||
&["cache_type"],
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
local_hits: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"trie_cache_local_hits",
|
||||
"Number of attempts hitting the local trie cache",
|
||||
),
|
||||
&["cache_type"],
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
local_fetch_attempts: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"trie_cache_local_fetch_attempts",
|
||||
"Number of attempts to the local cache",
|
||||
),
|
||||
&["cache_type"],
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
local_cache_lengths: register(
|
||||
HistogramVec::new(
|
||||
HistogramOpts {
|
||||
common_opts: Opts::new(
|
||||
"trie_cache_local_cache_lengths",
|
||||
"Histogram of length of the local cache",
|
||||
),
|
||||
buckets: exponential_buckets(1.0, 4.0, 9)
|
||||
.expect("function parameters are constant and always valid; qed"),
|
||||
},
|
||||
&["cache_type"],
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
shared_cache_inline_size: register(
|
||||
GaugeVec::new(
|
||||
Opts::new(
|
||||
"trie_cache_shared_cache_inline_size",
|
||||
"The inline size of the shared caches",
|
||||
),
|
||||
&["cache_type"],
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
shared_cache_heap_size: register(
|
||||
GaugeVec::new(
|
||||
Opts::new(
|
||||
"trie_cache_shared_cache_heap_size",
|
||||
"The heap size of the shared caches",
|
||||
),
|
||||
&["cache_type"],
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
})
|
||||
/// Stub registry type when prometheus is disabled.
|
||||
pub struct Registry;
|
||||
|
||||
/// Stub timer type.
|
||||
pub struct HistogramTimer;
|
||||
|
||||
impl Drop for HistogramTimer {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
/// Start a timer for the shared node cache update duration.
|
||||
pub(crate) fn start_shared_node_update_timer(&self) -> HistogramTimer {
|
||||
self.shared_update_duration.with_label_values(&["node"]).start_timer()
|
||||
}
|
||||
impl Metrics {
|
||||
/// Create a new instance of the metrics.
|
||||
pub(crate) fn register(_registry: &Registry) -> Result<Self, ()> {
|
||||
Ok(Self)
|
||||
}
|
||||
|
||||
/// Start a timer for the shared value cache update duration.
|
||||
pub(crate) fn start_shared_value_update_timer(&self) -> HistogramTimer {
|
||||
self.shared_update_duration.with_label_values(&["value"]).start_timer()
|
||||
}
|
||||
/// Start a timer for the shared node cache update duration.
|
||||
pub(crate) fn start_shared_node_update_timer(&self) -> HistogramTimer {
|
||||
HistogramTimer
|
||||
}
|
||||
|
||||
/// Observe the shared node cache length.
|
||||
pub(crate) fn observe_local_node_cache_length(&self, node_cache_len: usize) {
|
||||
self.local_cache_lengths
|
||||
.with_label_values(&["node"])
|
||||
.observe(node_cache_len as f64);
|
||||
}
|
||||
/// Start a timer for the shared value cache update duration.
|
||||
pub(crate) fn start_shared_value_update_timer(&self) -> HistogramTimer {
|
||||
HistogramTimer
|
||||
}
|
||||
|
||||
/// Observe the shared value cache length.
|
||||
pub(crate) fn observe_local_value_cache_length(&self, value_cache_len: usize) {
|
||||
self.local_cache_lengths
|
||||
.with_label_values(&["value"])
|
||||
.observe(value_cache_len as f64);
|
||||
}
|
||||
/// Observe the shared node cache length.
|
||||
pub(crate) fn observe_local_node_cache_length(&self, _node_cache_len: usize) {}
|
||||
|
||||
/// Observe the shared node cache inline size.
|
||||
pub(crate) fn observe_node_cache_inline_size(&self, cache_size: usize) {
|
||||
self.shared_cache_inline_size
|
||||
.with_label_values(&["node"])
|
||||
.set(cache_size as u64);
|
||||
}
|
||||
/// Observe the shared value cache length.
|
||||
pub(crate) fn observe_local_value_cache_length(&self, _value_cache_len: usize) {}
|
||||
|
||||
/// Observe the shared value cache inline size.
|
||||
pub(crate) fn observe_value_cache_inline_size(&self, cache_size: usize) {
|
||||
self.shared_cache_inline_size
|
||||
.with_label_values(&["value"])
|
||||
.set(cache_size as u64);
|
||||
}
|
||||
/// Observe the shared node cache inline size.
|
||||
pub(crate) fn observe_node_cache_inline_size(&self, _cache_size: usize) {}
|
||||
|
||||
/// Observe the shared node cache heap size.
|
||||
pub(crate) fn observe_node_cache_heap_size(&self, cache_size: usize) {
|
||||
self.shared_cache_heap_size.with_label_values(&["node"]).set(cache_size as u64);
|
||||
}
|
||||
/// Observe the shared value cache inline size.
|
||||
pub(crate) fn observe_value_cache_inline_size(&self, _cache_size: usize) {}
|
||||
|
||||
/// Observe the shared value cache heap size.
|
||||
pub(crate) fn observe_value_cache_heap_size(&self, cache_size: usize) {
|
||||
self.shared_cache_heap_size.with_label_values(&["value"]).set(cache_size as u64);
|
||||
}
|
||||
/// Observe the shared node cache heap size.
|
||||
pub(crate) fn observe_node_cache_heap_size(&self, _cache_size: usize) {}
|
||||
|
||||
/// Observe the hit stats from an instance of a local cache.
|
||||
pub(crate) fn observe_hits_stats(&self, stats: &TrieHitStatsSnapshot) {
|
||||
self.shared_hits
|
||||
.with_label_values(&["node"])
|
||||
.inc_by(stats.node_cache.shared_hits);
|
||||
self.shared_fetch_attempts
|
||||
.with_label_values(&["node"])
|
||||
.inc_by(stats.node_cache.shared_fetch_attempts);
|
||||
self.local_hits.with_label_values(&["node"]).inc_by(stats.node_cache.local_hits);
|
||||
self.local_fetch_attempts
|
||||
.with_label_values(&["node"])
|
||||
.inc_by(stats.node_cache.local_fetch_attempts);
|
||||
/// Observe the shared value cache heap size.
|
||||
pub(crate) fn observe_value_cache_heap_size(&self, _cache_size: usize) {}
|
||||
|
||||
self.shared_hits
|
||||
.with_label_values(&["value"])
|
||||
.inc_by(stats.value_cache.shared_hits);
|
||||
self.shared_fetch_attempts
|
||||
.with_label_values(&["value"])
|
||||
.inc_by(stats.value_cache.shared_fetch_attempts);
|
||||
self.local_hits
|
||||
.with_label_values(&["value"])
|
||||
.inc_by(stats.value_cache.local_hits);
|
||||
self.local_fetch_attempts
|
||||
.with_label_values(&["value"])
|
||||
.inc_by(stats.value_cache.local_fetch_attempts);
|
||||
/// Observe the hit stats from an instance of a local cache.
|
||||
pub(crate) fn observe_hits_stats(&self, _stats: &TrieHitStatsSnapshot) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ use core::{hash::Hash, time::Duration};
|
||||
use hash_db::Hasher;
|
||||
use nohash_hasher::BuildNoHashHasher;
|
||||
use parking_lot::{Mutex, RwLock, RwLockWriteGuard};
|
||||
use prometheus_endpoint::Registry;
|
||||
use super::metrics::Registry;
|
||||
use schnellru::LruMap;
|
||||
use std::{
|
||||
collections::{hash_map::Entry as SetEntry, HashMap},
|
||||
|
||||
Reference in New Issue
Block a user