mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Remove Prometheus metrics prefix (#9543)
* Remove Prometheus metrics prefix * Fix line widths * Missed some metrics * Fix CLI * Run rustfmt on modified files * Missing prefixes * Hopefully fix compilation * Rustfmt protocol.rs * Should compile now I guess * Rustfmt Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
@@ -36,7 +36,7 @@ pub use sc_telemetry::TelemetryEndpoints;
|
||||
pub use sc_transaction_pool::Options as TransactionPoolOptions;
|
||||
use sp_core::crypto::SecretString;
|
||||
use std::{
|
||||
io,
|
||||
io, iter,
|
||||
net::SocketAddr,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
@@ -188,10 +188,11 @@ impl PrometheusConfig {
|
||||
/// Create a new config using the default registry.
|
||||
///
|
||||
/// The default registry prefixes metrics with `substrate`.
|
||||
pub fn new_with_default_registry(port: SocketAddr) -> Self {
|
||||
pub fn new_with_default_registry(port: SocketAddr, chain_id: String) -> Self {
|
||||
let param = iter::once((String::from("chain"), chain_id)).collect();
|
||||
Self {
|
||||
port,
|
||||
registry: Registry::new_custom(Some("substrate".into()), None)
|
||||
registry: Registry::new_custom(None, Some(param))
|
||||
.expect("this can only fail if the prefix is empty"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ impl PrometheusMetrics {
|
||||
register(
|
||||
Gauge::<U64>::with_opts(
|
||||
Opts::new(
|
||||
"build_info",
|
||||
"substrate_build_info",
|
||||
"A metric with a constant '1' value labeled by name, version",
|
||||
)
|
||||
.const_label("name", name)
|
||||
@@ -65,8 +65,11 @@ impl PrometheusMetrics {
|
||||
)?
|
||||
.set(1);
|
||||
|
||||
register(Gauge::<U64>::new("node_roles", "The roles the node is running as")?, ®istry)?
|
||||
.set(roles);
|
||||
register(
|
||||
Gauge::<U64>::new("substrate_node_roles", "The roles the node is running as")?,
|
||||
®istry,
|
||||
)?
|
||||
.set(roles);
|
||||
|
||||
register_globals(registry)?;
|
||||
|
||||
@@ -74,7 +77,7 @@ impl PrometheusMetrics {
|
||||
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap_or_default();
|
||||
register(
|
||||
Gauge::<U64>::new(
|
||||
"process_start_time_seconds",
|
||||
"substrate_process_start_time_seconds",
|
||||
"Number of seconds between the UNIX epoch and the moment the process started",
|
||||
)?,
|
||||
registry,
|
||||
@@ -85,20 +88,20 @@ impl PrometheusMetrics {
|
||||
// generic internals
|
||||
block_height: register(
|
||||
GaugeVec::new(
|
||||
Opts::new("block_height", "Block height info of the chain"),
|
||||
Opts::new("substrate_block_height", "Block height info of the chain"),
|
||||
&["status"],
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
|
||||
number_leaves: register(
|
||||
Gauge::new("number_leaves", "Number of known chain leaves (aka forks)")?,
|
||||
Gauge::new("substrate_number_leaves", "Number of known chain leaves (aka forks)")?,
|
||||
registry,
|
||||
)?,
|
||||
|
||||
ready_transactions_number: register(
|
||||
Gauge::new(
|
||||
"ready_transactions_number",
|
||||
"substrate_ready_transactions_number",
|
||||
"Number of transactions in the ready queue",
|
||||
)?,
|
||||
registry,
|
||||
@@ -106,16 +109,16 @@ impl PrometheusMetrics {
|
||||
|
||||
// I/ O
|
||||
database_cache: register(
|
||||
Gauge::new("database_cache_bytes", "RocksDB cache size in bytes")?,
|
||||
Gauge::new("substrate_database_cache_bytes", "RocksDB cache size in bytes")?,
|
||||
registry,
|
||||
)?,
|
||||
state_cache: register(
|
||||
Gauge::new("state_cache_bytes", "State cache size in bytes")?,
|
||||
Gauge::new("substrate_state_cache_bytes", "State cache size in bytes")?,
|
||||
registry,
|
||||
)?,
|
||||
state_db: register(
|
||||
GaugeVec::new(
|
||||
Opts::new("state_db_cache_bytes", "State DB cache in bytes"),
|
||||
Opts::new("substrate_state_db_cache_bytes", "State DB cache in bytes"),
|
||||
&["subtype"],
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -401,7 +401,7 @@ impl Metrics {
|
||||
poll_duration: register(HistogramVec::new(
|
||||
HistogramOpts {
|
||||
common_opts: Opts::new(
|
||||
"tasks_polling_duration",
|
||||
"substrate_tasks_polling_duration",
|
||||
"Duration in seconds of each invocation of Future::poll"
|
||||
),
|
||||
buckets: exponential_buckets(0.001, 4.0, 9)
|
||||
@@ -411,21 +411,21 @@ impl Metrics {
|
||||
)?, registry)?,
|
||||
poll_start: register(CounterVec::new(
|
||||
Opts::new(
|
||||
"tasks_polling_started_total",
|
||||
"substrate_tasks_polling_started_total",
|
||||
"Total number of times we started invoking Future::poll"
|
||||
),
|
||||
&["task_name", "task_group"]
|
||||
)?, registry)?,
|
||||
tasks_spawned: register(CounterVec::new(
|
||||
Opts::new(
|
||||
"tasks_spawned_total",
|
||||
"substrate_tasks_spawned_total",
|
||||
"Total number of tasks that have been spawned on the Service"
|
||||
),
|
||||
&["task_name", "task_group"]
|
||||
)?, registry)?,
|
||||
tasks_ended: register(CounterVec::new(
|
||||
Opts::new(
|
||||
"tasks_ended_total",
|
||||
"substrate_tasks_ended_total",
|
||||
"Total number of tasks for which Future::poll has returned Ready(()) or panicked"
|
||||
),
|
||||
&["task_name", "reason", "task_group"]
|
||||
|
||||
Reference in New Issue
Block a user