(LedgerStore) Skip sampling check when ROCKSDB_PERF_CONTEXT_SAMPLES_IN_1K_DEFAULT = 0 (#24221)
#### Problem Currently, even if SOLANA_METRICS_ROCKSDB_PERF_SAMPLES_IN_1K == 0, we are still doing the sampling check for every RocksDB read. ``` thread_rng().gen_range(0, METRIC_SAMPLES_1K) > *ROCKSDB_PERF_CONTEXT_SAMPLES_IN_1K ``` #### Summary of Changes This PR skips the sampling check when SOLANA_METRICS_ROCKSDB_PERF_SAMPLES_IN_1K is set to 0.
This commit is contained in:
parent
9b8850f99e
commit
5a48ef72fd
|
@ -2295,6 +2295,9 @@ mod rocks_metrics_utils {
|
||||||
///
|
///
|
||||||
/// Returns true if the PerfContext is enabled.
|
/// Returns true if the PerfContext is enabled.
|
||||||
pub fn maybe_collect_perf_context() -> bool {
|
pub fn maybe_collect_perf_context() -> bool {
|
||||||
|
if *ROCKSDB_PERF_CONTEXT_SAMPLES_IN_1K <= 0 {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if thread_rng().gen_range(0, METRIC_SAMPLES_1K) > *ROCKSDB_PERF_CONTEXT_SAMPLES_IN_1K {
|
if thread_rng().gen_range(0, METRIC_SAMPLES_1K) > *ROCKSDB_PERF_CONTEXT_SAMPLES_IN_1K {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue