Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions rust/storage/src/monitor/state_store_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ pub const DEFAULT_BUCKETS: &[f64; 11] = &[
0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0,
];

pub const GET_KEY_SIZE_SCALE: f64 = 200.0;
pub const GET_VALUE_SIZE_SCALE: f64 = 200.0;
pub const BATCH_WRITE_SIZE_SCALE: f64 = 20000.0;

pub const GET_LATENCY_SCALE: f64 = 0.01;
pub const GET_SNAPSHOT_LATENCY_SCALE: f64 = 0.0001;
pub const WRITE_BATCH_LATENCY_SCALE: f64 = 0.0001;
Expand All @@ -22,6 +26,7 @@ pub const ITER_SEEK_LATENCY_SCALE: f64 = 0.0001;
/// In practice, keep in mind that this represents the whole Hummock utilizations of
/// a `RisingWave` instance. More granular utilizations of per `materialization view`
/// job or a executor should be collected by views like `StateStats` and `JobStats`.
#[derive(Debug)]
pub struct StateStoreStats {
/// Overall utilizations.
pub get_bytes: GenericCounter<AtomicU64>,
Expand Down Expand Up @@ -62,15 +67,19 @@ impl StateStoreStats {
)
.unwrap();

let buckets = DEFAULT_BUCKETS.map(|x| x * GET_KEY_SIZE_SCALE).to_vec();
let opts = histogram_opts!(
"state_store_get_key_size",
"Total key bytes of get that have been issued to state store"
"Total key bytes of get that have been issued to state store",
buckets
);
let get_key_size = register_histogram_with_registry!(opts, registry).unwrap();

let buckets = DEFAULT_BUCKETS.map(|x| x * GET_VALUE_SIZE_SCALE).to_vec();
let opts = histogram_opts!(
"state_store_get_value_size",
"Total value bytes that have been requested from remote storage",
buckets
);
let get_value_size = register_histogram_with_registry!(opts, registry).unwrap();

Expand Down Expand Up @@ -141,9 +150,11 @@ impl StateStoreStats {
);
let batch_write_latency = register_histogram_with_registry!(opts, registry).unwrap();

let buckets = DEFAULT_BUCKETS.map(|x| x * BATCH_WRITE_SIZE_SCALE).to_vec();
let opts = histogram_opts!(
"state_store_batched_write_size",
"Total size of batched write that have been issued to state store"
"Total size of batched write that have been issued to state store",
buckets
);
let batch_write_size = register_histogram_with_registry!(opts, registry).unwrap();

Expand Down