mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 05:37:58 +00:00
Add graphs for each function name (#4214)
This commit is contained in:
@@ -36,7 +36,7 @@ mod networking;
|
||||
pub use server::run_server;
|
||||
pub use util::now_millis;
|
||||
|
||||
type Metrics = HashMap<&'static str, Vec<(f32, i64)>>;
|
||||
type Metrics = HashMap<String, Vec<(f32, i64)>>;
|
||||
|
||||
lazy_static! {
|
||||
/// The `RwLock` wrapping the metrics. Not intended to be used directly.
|
||||
|
||||
@@ -26,8 +26,8 @@ async fn randomness() {
|
||||
let random = rand::thread_rng().gen_range(0.0, 1000.0);
|
||||
|
||||
record_metrics!(
|
||||
"random data" => random,
|
||||
"random^2" => random * random
|
||||
"random data".to_owned() => random,
|
||||
"random^2".to_owned() => random * random
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1005,15 +1005,15 @@ ServiceBuilder<
|
||||
"used_state_cache_size" => used_state_cache_size,
|
||||
);
|
||||
record_metrics!(
|
||||
"peers" => num_peers,
|
||||
"height" => best_number,
|
||||
"txcount" => txpool_status.ready,
|
||||
"cpu" => cpu_usage,
|
||||
"memory" => memory,
|
||||
"finalized_height" => finalized_number,
|
||||
"bandwidth_download" => bandwidth_download,
|
||||
"bandwidth_upload" => bandwidth_upload,
|
||||
"used_state_cache_size" => used_state_cache_size
|
||||
"peers".to_owned() => num_peers,
|
||||
"height".to_owned() => best_number,
|
||||
"txcount".to_owned() => txpool_status.ready,
|
||||
"cpu".to_owned() => cpu_usage,
|
||||
"memory".to_owned() => memory,
|
||||
"finalized_height".to_owned() => finalized_number,
|
||||
"bandwidth_download".to_owned() => bandwidth_download,
|
||||
"bandwidth_upload".to_owned() => bandwidth_upload,
|
||||
"used_state_cache_size".to_owned() => used_state_cache_size
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -202,5 +202,6 @@ fn send_telemetry(span_datum: SpanDatum) {
|
||||
}
|
||||
|
||||
fn send_grafana(span_datum: SpanDatum) {
|
||||
record_metrics!(span_datum.target => span_datum.overall_time.as_nanos());
|
||||
let name = format!("{}::{}", span_datum.target, span_datum.name);
|
||||
record_metrics!(name => span_datum.overall_time.as_nanos());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user