mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-15 04:25:19 +00:00
fix metrics rpc for Timer type
This commit is contained in:
parent
eb521fc24b
commit
061fc3ef58
@ -4,7 +4,7 @@ use crate::{error, Context};
|
|||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use jsonrpsee::core::async_trait;
|
use jsonrpsee::core::async_trait;
|
||||||
use jsonrpsee::core::RpcResult;
|
use jsonrpsee::core::RpcResult;
|
||||||
use metrics::DEFAULT_REGISTRY;
|
use metrics::{DEFAULT_GROUPING_REGISTRY, DEFAULT_REGISTRY};
|
||||||
use network::{multiaddr::Protocol, Multiaddr};
|
use network::{multiaddr::Protocol, Multiaddr};
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::{BTreeMap, HashMap};
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
@ -266,6 +266,21 @@ impl RpcServer for RpcServerImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (group_name, metrics) in DEFAULT_GROUPING_REGISTRY.read().get_all() {
|
||||||
|
for (metric_name, metric) in metrics.iter() {
|
||||||
|
let name = format!("{}.{}", group_name, metric_name);
|
||||||
|
match &maybe_prefix {
|
||||||
|
Some(prefix) if !name.starts_with(prefix) => {}
|
||||||
|
_ => {
|
||||||
|
result.insert(
|
||||||
|
name,
|
||||||
|
format!("{} {}", metric.get_type(), metric.get_value()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user