mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-08 19:28:01 +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:
@@ -121,7 +121,7 @@ impl<Block: BlockT> StorageNotifications<Block> {
|
||||
let metrics = prometheus_registry.and_then(|r| {
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"storage_notification_subscribers",
|
||||
"substrate_storage_notification_subscribers",
|
||||
"Number of subscribers in storage notification sytem",
|
||||
),
|
||||
&["action"], // added | removed
|
||||
|
||||
@@ -733,14 +733,14 @@ impl Metrics {
|
||||
Ok(Self {
|
||||
publish: register(
|
||||
Counter::new(
|
||||
"authority_discovery_times_published_total",
|
||||
"substrate_authority_discovery_times_published_total",
|
||||
"Number of times authority discovery has published external addresses.",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
amount_addresses_last_published: register(
|
||||
Gauge::new(
|
||||
"authority_discovery_amount_external_addresses_last_published",
|
||||
"substrate_authority_discovery_amount_external_addresses_last_published",
|
||||
"Number of external addresses published when authority discovery last \
|
||||
published addresses.",
|
||||
)?,
|
||||
@@ -748,7 +748,7 @@ impl Metrics {
|
||||
)?,
|
||||
requests: register(
|
||||
Counter::new(
|
||||
"authority_discovery_authority_addresses_requested_total",
|
||||
"substrate_authority_discovery_authority_addresses_requested_total",
|
||||
"Number of times authority discovery has requested external addresses of a \
|
||||
single authority.",
|
||||
)?,
|
||||
@@ -756,7 +756,7 @@ impl Metrics {
|
||||
)?,
|
||||
requests_pending: register(
|
||||
Gauge::new(
|
||||
"authority_discovery_authority_address_requests_pending",
|
||||
"substrate_authority_discovery_authority_address_requests_pending",
|
||||
"Number of pending authority address requests.",
|
||||
)?,
|
||||
registry,
|
||||
@@ -764,7 +764,7 @@ impl Metrics {
|
||||
dht_event_received: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"authority_discovery_dht_event_received",
|
||||
"substrate_authority_discovery_dht_event_received",
|
||||
"Number of dht events received by authority discovery.",
|
||||
),
|
||||
&["name"],
|
||||
@@ -773,14 +773,14 @@ impl Metrics {
|
||||
)?,
|
||||
handle_value_found_event_failure: register(
|
||||
Counter::new(
|
||||
"authority_discovery_handle_value_found_event_failure",
|
||||
"substrate_authority_discovery_handle_value_found_event_failure",
|
||||
"Number of times handling a dht value found event failed.",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
known_authorities_count: register(
|
||||
Gauge::new(
|
||||
"authority_discovery_known_authorities_count",
|
||||
"substrate_authority_discovery_known_authorities_count",
|
||||
"Number of authorities known by authority discovery.",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -40,28 +40,34 @@ impl Metrics {
|
||||
pub(crate) fn register(registry: &Registry) -> Result<Self, PrometheusError> {
|
||||
Ok(Self {
|
||||
beefy_validator_set_id: register(
|
||||
Gauge::new("beefy_validator_set_id", "Current BEEFY active validator set id.")?,
|
||||
Gauge::new(
|
||||
"substrate_beefy_validator_set_id",
|
||||
"Current BEEFY active validator set id.",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
beefy_votes_sent: register(
|
||||
Counter::new("beefy_votes_sent", "Number of votes sent by this node")?,
|
||||
Counter::new("substrate_beefy_votes_sent", "Number of votes sent by this node")?,
|
||||
registry,
|
||||
)?,
|
||||
beefy_round_concluded: register(
|
||||
Gauge::new("beefy_round_concluded", "Voting round, that has been concluded")?,
|
||||
Gauge::new(
|
||||
"substrate_beefy_round_concluded",
|
||||
"Voting round, that has been concluded",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
beefy_best_block: register(
|
||||
Gauge::new("beefy_best_block", "Best block finalized by BEEFY")?,
|
||||
Gauge::new("substrate_beefy_best_block", "Best block finalized by BEEFY")?,
|
||||
registry,
|
||||
)?,
|
||||
beefy_should_vote_on: register(
|
||||
Gauge::new("beefy_should_vote_on", "Next block, BEEFY should vote on")?,
|
||||
Gauge::new("substrate_beefy_should_vote_on", "Next block, BEEFY should vote on")?,
|
||||
registry,
|
||||
)?,
|
||||
beefy_skipped_sessions: register(
|
||||
Counter::new(
|
||||
"beefy_skipped_sessions",
|
||||
"substrate_beefy_skipped_sessions",
|
||||
"Number of sessions without a signed commitment",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -368,10 +368,13 @@ impl CliConfiguration for RunCmd {
|
||||
let interface =
|
||||
if self.prometheus_external { Ipv4Addr::UNSPECIFIED } else { Ipv4Addr::LOCALHOST };
|
||||
|
||||
Some(PrometheusConfig::new_with_default_registry(SocketAddr::new(
|
||||
interface.into(),
|
||||
self.prometheus_port.unwrap_or(default_listen_port),
|
||||
)))
|
||||
Some(PrometheusConfig::new_with_default_registry(
|
||||
SocketAddr::new(
|
||||
interface.into(),
|
||||
self.prometheus_port.unwrap_or(default_listen_port),
|
||||
),
|
||||
self.shared_params.chain_id(self.shared_params.dev),
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -41,28 +41,34 @@ impl Metrics {
|
||||
Ok(Self {
|
||||
import_queue_processed: register(
|
||||
CounterVec::new(
|
||||
Opts::new("import_queue_processed_total", "Blocks processed by import queue"),
|
||||
Opts::new(
|
||||
"substrate_import_queue_processed_total",
|
||||
"Blocks processed by import queue",
|
||||
),
|
||||
&["result"], // 'success or failure
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
block_verification_time: register(
|
||||
HistogramVec::new(
|
||||
HistogramOpts::new("block_verification_time", "Time taken to verify blocks"),
|
||||
HistogramOpts::new(
|
||||
"substrate_block_verification_time",
|
||||
"Time taken to verify blocks",
|
||||
),
|
||||
&["result"],
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
block_verification_and_import_time: register(
|
||||
Histogram::with_opts(HistogramOpts::new(
|
||||
"block_verification_and_import_time",
|
||||
"substrate_block_verification_and_import_time",
|
||||
"Time taken to verify and import blocks",
|
||||
))?,
|
||||
registry,
|
||||
)?,
|
||||
justification_import_time: register(
|
||||
Histogram::with_opts(HistogramOpts::new(
|
||||
"justification_import_time",
|
||||
"substrate_justification_import_time",
|
||||
"Time taken to import justifications",
|
||||
))?,
|
||||
registry,
|
||||
|
||||
@@ -1299,7 +1299,7 @@ impl Metrics {
|
||||
messages_validated: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"finality_grandpa_communication_gossip_validator_messages",
|
||||
"substrate_finality_grandpa_communication_gossip_validator_messages",
|
||||
"Number of messages validated by the finality grandpa gossip validator.",
|
||||
),
|
||||
&["message", "action"],
|
||||
|
||||
@@ -404,19 +404,19 @@ impl Metrics {
|
||||
) -> Result<Self, PrometheusError> {
|
||||
Ok(Self {
|
||||
finality_grandpa_round: register(
|
||||
Gauge::new("finality_grandpa_round", "Highest completed GRANDPA round.")?,
|
||||
Gauge::new("substrate_finality_grandpa_round", "Highest completed GRANDPA round.")?,
|
||||
registry,
|
||||
)?,
|
||||
finality_grandpa_prevotes: register(
|
||||
Counter::new(
|
||||
"finality_grandpa_prevotes_total",
|
||||
"substrate_finality_grandpa_prevotes_total",
|
||||
"Total number of GRANDPA prevotes cast locally.",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
finality_grandpa_precommits: register(
|
||||
Counter::new(
|
||||
"finality_grandpa_precommits_total",
|
||||
"substrate_finality_grandpa_precommits_total",
|
||||
"Total number of GRANDPA precommits cast locally.",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -100,7 +100,7 @@ impl Metrics {
|
||||
Ok(Self {
|
||||
global_waiting_messages: register(
|
||||
Gauge::new(
|
||||
"finality_grandpa_until_imported_waiting_messages_number",
|
||||
"substrate_finality_grandpa_until_imported_waiting_messages_number",
|
||||
"Number of finality grandpa messages waiting within the until imported queue.",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -508,14 +508,14 @@ impl Metrics {
|
||||
Ok(Self {
|
||||
registered_messages: register(
|
||||
Counter::new(
|
||||
"network_gossip_registered_messages_total",
|
||||
"substrate_network_gossip_registered_messages_total",
|
||||
"Number of registered messages by the gossip service.",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
expired_messages: register(
|
||||
Counter::new(
|
||||
"network_gossip_expired_messages_total",
|
||||
"substrate_network_gossip_expired_messages_total",
|
||||
"Number of expired messages by the gossip service.",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -132,21 +132,22 @@ impl Metrics {
|
||||
fn register(r: &Registry) -> Result<Self, PrometheusError> {
|
||||
Ok(Self {
|
||||
peers: {
|
||||
let g = Gauge::new("sync_peers", "Number of peers we sync with")?;
|
||||
let g = Gauge::new("substrate_sync_peers", "Number of peers we sync with")?;
|
||||
register(g, r)?
|
||||
},
|
||||
queued_blocks: {
|
||||
let g = Gauge::new("sync_queued_blocks", "Number of blocks in import queue")?;
|
||||
let g =
|
||||
Gauge::new("substrate_sync_queued_blocks", "Number of blocks in import queue")?;
|
||||
register(g, r)?
|
||||
},
|
||||
fork_targets: {
|
||||
let g = Gauge::new("sync_fork_targets", "Number of fork sync targets")?;
|
||||
let g = Gauge::new("substrate_sync_fork_targets", "Number of fork sync targets")?;
|
||||
register(g, r)?
|
||||
},
|
||||
justifications: {
|
||||
let g = GaugeVec::new(
|
||||
Opts::new(
|
||||
"sync_extra_justifications",
|
||||
"substrate_sync_extra_justifications",
|
||||
"Number of extra justifications requests",
|
||||
),
|
||||
&["status"],
|
||||
|
||||
@@ -84,54 +84,54 @@ impl Metrics {
|
||||
// This list is ordered alphabetically
|
||||
connections_closed_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_connections_closed_total",
|
||||
"substrate_sub_libp2p_connections_closed_total",
|
||||
"Total number of connections closed, by direction and reason"
|
||||
),
|
||||
&["direction", "reason"]
|
||||
)?, registry)?,
|
||||
connections_opened_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_connections_opened_total",
|
||||
"substrate_sub_libp2p_connections_opened_total",
|
||||
"Total number of connections opened by direction"
|
||||
),
|
||||
&["direction"]
|
||||
)?, registry)?,
|
||||
distinct_peers_connections_closed_total: prometheus::register(Counter::new(
|
||||
"sub_libp2p_distinct_peers_connections_closed_total",
|
||||
"substrate_sub_libp2p_distinct_peers_connections_closed_total",
|
||||
"Total number of connections closed with distinct peers"
|
||||
)?, registry)?,
|
||||
distinct_peers_connections_opened_total: prometheus::register(Counter::new(
|
||||
"sub_libp2p_distinct_peers_connections_opened_total",
|
||||
"substrate_sub_libp2p_distinct_peers_connections_opened_total",
|
||||
"Total number of connections opened with distinct peers"
|
||||
)?, registry)?,
|
||||
import_queue_blocks_submitted: prometheus::register(Counter::new(
|
||||
"import_queue_blocks_submitted",
|
||||
"substrate_import_queue_blocks_submitted",
|
||||
"Number of blocks submitted to the import queue.",
|
||||
)?, registry)?,
|
||||
import_queue_justifications_submitted: prometheus::register(Counter::new(
|
||||
"import_queue_justifications_submitted",
|
||||
"substrate_import_queue_justifications_submitted",
|
||||
"Number of justifications submitted to the import queue.",
|
||||
)?, registry)?,
|
||||
incoming_connections_errors_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_incoming_connections_handshake_errors_total",
|
||||
"substrate_sub_libp2p_incoming_connections_handshake_errors_total",
|
||||
"Total number of incoming connections that have failed during the \
|
||||
initial handshake"
|
||||
),
|
||||
&["reason"]
|
||||
)?, registry)?,
|
||||
incoming_connections_total: prometheus::register(Counter::new(
|
||||
"sub_libp2p_incoming_connections_total",
|
||||
"substrate_sub_libp2p_incoming_connections_total",
|
||||
"Total number of incoming connections on the listening sockets"
|
||||
)?, registry)?,
|
||||
issued_light_requests: prometheus::register(Counter::new(
|
||||
"issued_light_requests",
|
||||
"substrate_issued_light_requests",
|
||||
"Number of light client requests that our node has issued.",
|
||||
)?, registry)?,
|
||||
kademlia_query_duration: prometheus::register(HistogramVec::new(
|
||||
HistogramOpts {
|
||||
common_opts: Opts::new(
|
||||
"sub_libp2p_kademlia_query_duration",
|
||||
"substrate_sub_libp2p_kademlia_query_duration",
|
||||
"Duration of Kademlia queries per query type"
|
||||
),
|
||||
buckets: prometheus::exponential_buckets(0.5, 2.0, 10)
|
||||
@@ -141,43 +141,44 @@ impl Metrics {
|
||||
)?, registry)?,
|
||||
kademlia_random_queries_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_kademlia_random_queries_total",
|
||||
"substrate_sub_libp2p_kademlia_random_queries_total",
|
||||
"Number of random Kademlia queries started"
|
||||
),
|
||||
&["protocol"]
|
||||
)?, registry)?,
|
||||
kademlia_records_count: prometheus::register(GaugeVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_kademlia_records_count",
|
||||
"substrate_sub_libp2p_kademlia_records_count",
|
||||
"Number of records in the Kademlia records store"
|
||||
),
|
||||
&["protocol"]
|
||||
)?, registry)?,
|
||||
kademlia_records_sizes_total: prometheus::register(GaugeVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_kademlia_records_sizes_total",
|
||||
"substrate_sub_libp2p_kademlia_records_sizes_total",
|
||||
"Total size of all the records in the Kademlia records store"
|
||||
),
|
||||
&["protocol"]
|
||||
)?, registry)?,
|
||||
kbuckets_num_nodes: prometheus::register(GaugeVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_kbuckets_num_nodes",
|
||||
"substrate_sub_libp2p_kbuckets_num_nodes",
|
||||
"Number of nodes per kbucket per Kademlia instance"
|
||||
),
|
||||
&["protocol", "lower_ilog2_bucket_bound"]
|
||||
)?, registry)?,
|
||||
listeners_local_addresses: prometheus::register(Gauge::new(
|
||||
"sub_libp2p_listeners_local_addresses", "Number of local addresses we're listening on"
|
||||
"substrate_sub_libp2p_listeners_local_addresses",
|
||||
"Number of local addresses we're listening on"
|
||||
)?, registry)?,
|
||||
listeners_errors_total: prometheus::register(Counter::new(
|
||||
"sub_libp2p_listeners_errors_total",
|
||||
"substrate_sub_libp2p_listeners_errors_total",
|
||||
"Total number of non-fatal errors reported by a listener"
|
||||
)?, registry)?,
|
||||
notifications_sizes: prometheus::register(HistogramVec::new(
|
||||
HistogramOpts {
|
||||
common_opts: Opts::new(
|
||||
"sub_libp2p_notifications_sizes",
|
||||
"substrate_sub_libp2p_notifications_sizes",
|
||||
"Sizes of the notifications send to and received from all nodes"
|
||||
),
|
||||
buckets: prometheus::exponential_buckets(64.0, 4.0, 8)
|
||||
@@ -187,38 +188,40 @@ impl Metrics {
|
||||
)?, registry)?,
|
||||
notifications_streams_closed_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_notifications_streams_closed_total",
|
||||
"substrate_sub_libp2p_notifications_streams_closed_total",
|
||||
"Total number of notification substreams that have been closed"
|
||||
),
|
||||
&["protocol"]
|
||||
)?, registry)?,
|
||||
notifications_streams_opened_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_notifications_streams_opened_total",
|
||||
"substrate_sub_libp2p_notifications_streams_opened_total",
|
||||
"Total number of notification substreams that have been opened"
|
||||
),
|
||||
&["protocol"]
|
||||
)?, registry)?,
|
||||
peerset_num_discovered: prometheus::register(Gauge::new(
|
||||
"sub_libp2p_peerset_num_discovered", "Number of nodes stored in the peerset manager",
|
||||
"substrate_sub_libp2p_peerset_num_discovered",
|
||||
"Number of nodes stored in the peerset manager",
|
||||
)?, registry)?,
|
||||
peerset_num_requested: prometheus::register(Gauge::new(
|
||||
"sub_libp2p_peerset_num_requested", "Number of nodes that the peerset manager wants us to be connected to",
|
||||
"substrate_sub_libp2p_peerset_num_requested",
|
||||
"Number of nodes that the peerset manager wants us to be connected to",
|
||||
)?, registry)?,
|
||||
pending_connections: prometheus::register(Gauge::new(
|
||||
"sub_libp2p_pending_connections",
|
||||
"substrate_sub_libp2p_pending_connections",
|
||||
"Number of connections in the process of being established",
|
||||
)?, registry)?,
|
||||
pending_connections_errors_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_pending_connections_errors_total",
|
||||
"substrate_sub_libp2p_pending_connections_errors_total",
|
||||
"Total number of pending connection errors"
|
||||
),
|
||||
&["reason"]
|
||||
)?, registry)?,
|
||||
requests_in_failure_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_requests_in_failure_total",
|
||||
"substrate_sub_libp2p_requests_in_failure_total",
|
||||
"Total number of incoming requests that the node has failed to answer"
|
||||
),
|
||||
&["protocol", "reason"]
|
||||
@@ -226,7 +229,7 @@ impl Metrics {
|
||||
requests_in_success_total: prometheus::register(HistogramVec::new(
|
||||
HistogramOpts {
|
||||
common_opts: Opts::new(
|
||||
"sub_libp2p_requests_in_success_total",
|
||||
"substrate_sub_libp2p_requests_in_success_total",
|
||||
"For successful incoming requests, time between receiving the request and \
|
||||
starting to send the response"
|
||||
),
|
||||
@@ -237,7 +240,7 @@ impl Metrics {
|
||||
)?, registry)?,
|
||||
requests_out_failure_total: prometheus::register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_requests_out_failure_total",
|
||||
"substrate_sub_libp2p_requests_out_failure_total",
|
||||
"Total number of requests that have failed"
|
||||
),
|
||||
&["protocol", "reason"]
|
||||
@@ -245,7 +248,7 @@ impl Metrics {
|
||||
requests_out_success_total: prometheus::register(HistogramVec::new(
|
||||
HistogramOpts {
|
||||
common_opts: Opts::new(
|
||||
"sub_libp2p_requests_out_success_total",
|
||||
"substrate_sub_libp2p_requests_out_success_total",
|
||||
"For successful outgoing requests, time between a request's start and finish"
|
||||
),
|
||||
buckets: prometheus::exponential_buckets(0.001, 2.0, 16)
|
||||
@@ -267,7 +270,7 @@ impl BandwidthCounters {
|
||||
fn register(registry: &Registry, sinks: Arc<BandwidthSinks>) -> Result<(), PrometheusError> {
|
||||
prometheus::register(
|
||||
SourcedCounter::new(
|
||||
&Opts::new("sub_libp2p_network_bytes_total", "Total bandwidth usage")
|
||||
&Opts::new("substrate_sub_libp2p_network_bytes_total", "Total bandwidth usage")
|
||||
.variable_label("direction"),
|
||||
BandwidthCounters(sinks),
|
||||
)?,
|
||||
@@ -298,7 +301,7 @@ impl MajorSyncingGauge {
|
||||
prometheus::register(
|
||||
SourcedGauge::new(
|
||||
&Opts::new(
|
||||
"sub_libp2p_is_major_syncing",
|
||||
"substrate_sub_libp2p_is_major_syncing",
|
||||
"Whether the node is performing a major sync or not.",
|
||||
),
|
||||
MajorSyncingGauge(value),
|
||||
@@ -328,7 +331,7 @@ impl NumConnectedGauge {
|
||||
fn register(registry: &Registry, value: Arc<AtomicUsize>) -> Result<(), PrometheusError> {
|
||||
prometheus::register(
|
||||
SourcedGauge::new(
|
||||
&Opts::new("sub_libp2p_peers_count", "Number of connected peers"),
|
||||
&Opts::new("substrate_sub_libp2p_peers_count", "Number of connected peers"),
|
||||
NumConnectedGauge(value),
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -192,7 +192,7 @@ impl Metrics {
|
||||
Ok(Self {
|
||||
events_total: register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_out_events_events_total",
|
||||
"substrate_sub_libp2p_out_events_events_total",
|
||||
"Number of broadcast network events that have been sent or received across all \
|
||||
channels"
|
||||
),
|
||||
@@ -200,7 +200,7 @@ impl Metrics {
|
||||
)?, registry)?,
|
||||
notifications_sizes: register(CounterVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_out_events_notifications_sizes",
|
||||
"substrate_sub_libp2p_out_events_notifications_sizes",
|
||||
"Size of notification events that have been sent or received across all \
|
||||
channels"
|
||||
),
|
||||
@@ -208,7 +208,7 @@ impl Metrics {
|
||||
)?, registry)?,
|
||||
num_channels: register(GaugeVec::new(
|
||||
Opts::new(
|
||||
"sub_libp2p_out_events_num_channels",
|
||||
"substrate_sub_libp2p_out_events_num_channels",
|
||||
"Number of internal active channels that broadcast network events",
|
||||
),
|
||||
&["name"]
|
||||
|
||||
@@ -95,7 +95,7 @@ impl Metrics {
|
||||
Ok(Self {
|
||||
propagated_transactions: register(
|
||||
Counter::new(
|
||||
"sync_propagated_transactions",
|
||||
"substrate_sync_propagated_transactions",
|
||||
"Number of transactions propagated to at least one peer",
|
||||
)?,
|
||||
r,
|
||||
|
||||
@@ -56,14 +56,14 @@ impl Metrics {
|
||||
Ok(Self {
|
||||
block_constructed: register(
|
||||
Histogram::with_opts(HistogramOpts::new(
|
||||
"proposer_block_constructed",
|
||||
"substrate_proposer_block_constructed",
|
||||
"Histogram of time taken to construct new block",
|
||||
))?,
|
||||
registry,
|
||||
)?,
|
||||
number_of_transactions: register(
|
||||
Gauge::new(
|
||||
"proposer_number_of_transactions",
|
||||
"substrate_proposer_number_of_transactions",
|
||||
"Number of transactions included in block",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -90,7 +90,7 @@ impl ServerMetrics {
|
||||
Ok(Self {
|
||||
session_opened: register(
|
||||
Counter::new(
|
||||
"rpc_sessions_opened",
|
||||
"substrate_rpc_sessions_opened",
|
||||
"Number of persistent RPC sessions opened",
|
||||
)?,
|
||||
r,
|
||||
@@ -98,7 +98,7 @@ impl ServerMetrics {
|
||||
.into(),
|
||||
session_closed: register(
|
||||
Counter::new(
|
||||
"rpc_sessions_closed",
|
||||
"substrate_rpc_sessions_closed",
|
||||
"Number of persistent RPC sessions closed",
|
||||
)?,
|
||||
r,
|
||||
|
||||
@@ -48,7 +48,7 @@ impl RpcMetrics {
|
||||
requests_started: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"rpc_requests_started",
|
||||
"substrate_rpc_requests_started",
|
||||
"Number of RPC requests (not calls) received by the server.",
|
||||
),
|
||||
&["protocol"],
|
||||
@@ -58,7 +58,7 @@ impl RpcMetrics {
|
||||
requests_finished: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"rpc_requests_finished",
|
||||
"substrate_rpc_requests_finished",
|
||||
"Number of RPC requests (not calls) processed by the server.",
|
||||
),
|
||||
&["protocol"],
|
||||
@@ -68,7 +68,7 @@ impl RpcMetrics {
|
||||
calls_time: register(
|
||||
HistogramVec::new(
|
||||
HistogramOpts::new(
|
||||
"rpc_calls_time",
|
||||
"substrate_rpc_calls_time",
|
||||
"Total time [μs] of processed RPC calls",
|
||||
),
|
||||
&["protocol", "method"],
|
||||
@@ -78,7 +78,7 @@ impl RpcMetrics {
|
||||
calls_started: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"rpc_calls_started",
|
||||
"substrate_rpc_calls_started",
|
||||
"Number of received RPC calls (unique un-batched requests)",
|
||||
),
|
||||
&["protocol", "method"],
|
||||
@@ -88,7 +88,7 @@ impl RpcMetrics {
|
||||
calls_finished: register(
|
||||
CounterVec::new(
|
||||
Opts::new(
|
||||
"rpc_calls_finished",
|
||||
"substrate_rpc_calls_finished",
|
||||
"Number of processed RPC calls (unique un-batched requests)",
|
||||
),
|
||||
&["protocol", "method", "is_error"],
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -56,28 +56,28 @@ impl Metrics {
|
||||
Ok(Self {
|
||||
submitted_transactions: register(
|
||||
Counter::new(
|
||||
"sub_txpool_submitted_transactions",
|
||||
"substrate_sub_txpool_submitted_transactions",
|
||||
"Total number of transactions submitted",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
validations_invalid: register(
|
||||
Counter::new(
|
||||
"sub_txpool_validations_invalid",
|
||||
"substrate_sub_txpool_validations_invalid",
|
||||
"Total number of transactions that were removed from the pool as invalid",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
block_transactions_pruned: register(
|
||||
Counter::new(
|
||||
"sub_txpool_block_transactions_pruned",
|
||||
"substrate_sub_txpool_block_transactions_pruned",
|
||||
"Total number of transactions that was requested to be pruned by block events",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
block_transactions_resubmitted: register(
|
||||
Counter::new(
|
||||
"sub_txpool_block_transactions_resubmitted",
|
||||
"substrate_sub_txpool_block_transactions_resubmitted",
|
||||
"Total number of transactions that was requested to be resubmitted by block events",
|
||||
)?,
|
||||
registry,
|
||||
@@ -98,14 +98,14 @@ impl ApiMetrics {
|
||||
Ok(Self {
|
||||
validations_scheduled: register(
|
||||
Counter::new(
|
||||
"sub_txpool_validations_scheduled",
|
||||
"substrate_sub_txpool_validations_scheduled",
|
||||
"Total number of transactions scheduled for validation",
|
||||
)?,
|
||||
registry,
|
||||
)?,
|
||||
validations_finished: register(
|
||||
Counter::new(
|
||||
"sub_txpool_validations_finished",
|
||||
"substrate_sub_txpool_validations_finished",
|
||||
"Total number of transactions that finished validation",
|
||||
)?,
|
||||
registry,
|
||||
|
||||
@@ -29,17 +29,17 @@ use prometheus::{core::GenericCounterVec, Opts};
|
||||
|
||||
lazy_static! {
|
||||
pub static ref TOKIO_THREADS_TOTAL: GenericCounter<AtomicU64> =
|
||||
GenericCounter::new("tokio_threads_total", "Total number of threads created")
|
||||
GenericCounter::new("substrate_tokio_threads_total", "Total number of threads created")
|
||||
.expect("Creating of statics doesn't fail. qed");
|
||||
pub static ref TOKIO_THREADS_ALIVE: GenericGauge<AtomicU64> =
|
||||
GenericGauge::new("tokio_threads_alive", "Number of threads alive right now")
|
||||
GenericGauge::new("substrate_tokio_threads_alive", "Number of threads alive right now")
|
||||
.expect("Creating of statics doesn't fail. qed");
|
||||
}
|
||||
|
||||
#[cfg(feature = "metered")]
|
||||
lazy_static! {
|
||||
pub static ref UNBOUNDED_CHANNELS_COUNTER : GenericCounterVec<AtomicU64> = GenericCounterVec::new(
|
||||
Opts::new("unbounded_channel_len", "Items in each mpsc::unbounded instance"),
|
||||
Opts::new("substrate_unbounded_channel_len", "Items in each mpsc::unbounded instance"),
|
||||
&["entity", "action"] // 'name of channel, send|received|dropped
|
||||
).expect("Creating of statics doesn't fail. qed");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user