-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
151 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use prometheus::{ | ||
register_histogram_vec_with_registry, register_int_counter_vec_with_registry, HistogramVec, | ||
IntCounterVec, Registry, | ||
}; | ||
use std::sync::Arc; | ||
|
||
pub(crate) struct KvMetrics { | ||
pub kv_get_success: IntCounterVec, | ||
pub kv_get_not_found: IntCounterVec, | ||
pub kv_get_errors: IntCounterVec, | ||
pub kv_get_latency_ms: HistogramVec, | ||
pub kv_get_batch_size: HistogramVec, | ||
pub kv_get_latency_ms_per_key: HistogramVec, | ||
} | ||
|
||
impl KvMetrics { | ||
pub(crate) fn new(registry: &Registry) -> Arc<Self> { | ||
Arc::new(Self { | ||
kv_get_success: register_int_counter_vec_with_registry!( | ||
"kv_get_success", | ||
"Number of successful fetches from kv store", | ||
&["client", "table"], | ||
registry, | ||
) | ||
.unwrap(), | ||
kv_get_not_found: register_int_counter_vec_with_registry!( | ||
"kv_get_not_found", | ||
"Number of fetches from kv store that returned not found", | ||
&["client", "table"], | ||
registry, | ||
) | ||
.unwrap(), | ||
kv_get_errors: register_int_counter_vec_with_registry!( | ||
"kv_get_errors", | ||
"Number of fetches from kv store that returned an error", | ||
&["client", "table"], | ||
registry, | ||
) | ||
.unwrap(), | ||
kv_get_latency_ms: register_histogram_vec_with_registry!( | ||
"kv_get_latency_ms", | ||
"Latency of fetches from kv store", | ||
&["client", "table"], | ||
prometheus::exponential_buckets(1.0, 1.6, 24) | ||
.unwrap() | ||
.to_vec(), | ||
registry, | ||
) | ||
.unwrap(), | ||
kv_get_batch_size: register_histogram_vec_with_registry!( | ||
"kv_get_batch_size", | ||
"Number of keys fetched per batch from kv store", | ||
&["client", "table"], | ||
prometheus::exponential_buckets(1.0, 1.6, 20) | ||
.unwrap() | ||
.to_vec(), | ||
registry, | ||
) | ||
.unwrap(), | ||
kv_get_latency_ms_per_key: register_histogram_vec_with_registry!( | ||
"kv_get_latency_ms_per_key", | ||
"Latency of fetches from kv store per key", | ||
&["client", "table"], | ||
prometheus::exponential_buckets(1.0, 1.6, 24) | ||
.unwrap() | ||
.to_vec(), | ||
registry, | ||
) | ||
.unwrap(), | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters