Use interoperable names for common metrics

These names match the equivalent metrics in zcashd, enabling common
metrics to be collected across both node types.
This commit is contained in:
Jack Grigg 2021-03-14 15:03:13 +13:00 committed by teor
parent 9c0c2f0848
commit e51f33a4b9
6 changed files with 27 additions and 27 deletions

View File

@ -75,7 +75,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "block_verified_block_height{job=\"$job\"}", "expr": "zcash_chain_verified_block_height{job=\"$job\"}",
"interval": "", "interval": "",
"legendFormat": "verified block height", "legendFormat": "verified block height",
"refId": "A" "refId": "A"
@ -179,7 +179,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "block_verified_block_height{job=\"$job\"}", "expr": "zcash_chain_verified_block_height{job=\"$job\"}",
"interval": "", "interval": "",
"legendFormat": "verified block height", "legendFormat": "verified block height",
"refId": "A" "refId": "A"
@ -283,9 +283,9 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "rate(block_verified_block_count{job=\"$job\"}[1s])", "expr": "rate(zcash_chain_verified_block_total{job=\"$job\"}[1s])",
"interval": "", "interval": "",
"legendFormat": "block_verified_block_count[1s]", "legendFormat": "zcash_chain_verified_block_total[1s]",
"refId": "A" "refId": "A"
}, },
{ {
@ -406,9 +406,9 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "rate(block_verified_block_count{job=\"$job\"}[1s])", "expr": "rate(zcash_chain_verified_block_total{job=\"$job\"}[1s])",
"interval": "", "interval": "",
"legendFormat": "block_verified_block_count[1s]", "legendFormat": "zcash_chain_verified_block_total[1s]",
"refId": "A" "refId": "A"
}, },
{ {
@ -528,9 +528,9 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "rate(block_verified_block_count{job=\"$job\"}[1s])", "expr": "rate(zcash_chain_verified_block_total{job=\"$job\"}[1s])",
"interval": "", "interval": "",
"legendFormat": "block_verified_block_count[1s]", "legendFormat": "zcash_chain_verified_block_total[1s]",
"refId": "A" "refId": "A"
}, },
{ {
@ -651,9 +651,9 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "rate(block_verified_block_count{job=\"$job\"}[1s])", "expr": "rate(zcash_chain_verified_block_total{job=\"$job\"}[1s])",
"interval": "", "interval": "",
"legendFormat": "block_verified_block_count[1s]", "legendFormat": "zcash_chain_verified_block_total[1s]",
"refId": "A" "refId": "A"
}, },
{ {
@ -735,14 +735,14 @@
] ]
}, },
"datasource": "Prometheus-Zebra", "datasource": "Prometheus-Zebra",
"definition": "label_values(block_verified_block_height, job)", "definition": "label_values(zcash_chain_verified_block_height, job)",
"hide": 0, "hide": 0,
"includeAll": true, "includeAll": true,
"label": null, "label": null,
"multi": true, "multi": true,
"name": "job", "name": "job",
"options": [], "options": [],
"query": "label_values(block_verified_block_height, job)", "query": "label_values(zcash_chain_verified_block_height, job)",
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,

View File

@ -76,14 +76,14 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "sum(rate(bytes_read{job=\"$job\"}[1s]))", "expr": "sum(rate(zcash_net_in_bytes_total{job=\"$job\"}[1s]))",
"hide": false, "hide": false,
"interval": "", "interval": "",
"legendFormat": "bytes read [1s]", "legendFormat": "bytes read [1s]",
"refId": "A" "refId": "A"
}, },
{ {
"expr": "sum(rate(bytes_written{job=\"$job\"}[1s]))", "expr": "sum(rate(zcash_net_out_bytes_total{job=\"$job\"}[1s]))",
"interval": "", "interval": "",
"legendFormat": "bytes written [1s]", "legendFormat": "bytes written [1s]",
"refId": "B" "refId": "B"
@ -188,14 +188,14 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "sum(rate(bytes_read{job=\"$job\"}[1s]))", "expr": "sum(rate(zcash_net_in_bytes_total{job=\"$job\"}[1s]))",
"hide": false, "hide": false,
"interval": "", "interval": "",
"legendFormat": "bytes read [1s]", "legendFormat": "bytes read [1s]",
"refId": "A" "refId": "A"
}, },
{ {
"expr": "sum(rate(bytes_written{job=\"$job\"}[1s]))", "expr": "sum(rate(zcash_net_out_bytes_total{job=\"$job\"}[1s]))",
"interval": "", "interval": "",
"legendFormat": "bytes written [1s]", "legendFormat": "bytes written [1s]",
"refId": "B" "refId": "B"
@ -299,7 +299,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "pool_num_peers{job=\"$job\"}", "expr": "zcash_net_peers{job=\"$job\"}",
"interval": "", "interval": "",
"legendFormat": "total peers", "legendFormat": "total peers",
"refId": "A" "refId": "A"
@ -416,7 +416,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"expr": "pool_num_peers{job=\"$job\"}", "expr": "zcash_net_peers{job=\"$job\"}",
"interval": "", "interval": "",
"legendFormat": "total peers", "legendFormat": "total peers",
"refId": "A" "refId": "A"
@ -763,14 +763,14 @@
] ]
}, },
"datasource": "Prometheus-Zebra", "datasource": "Prometheus-Zebra",
"definition": "label_values(bytes_read, job)", "definition": "label_values(zcash_net_in_bytes_total, job)",
"hide": 0, "hide": 0,
"includeAll": true, "includeAll": true,
"label": null, "label": null,
"multi": true, "multi": true,
"name": "job", "name": "job",
"options": [], "options": [],
"query": "label_values(bytes_read, job)", "query": "label_values(zcash_net_in_bytes_total, job)",
"refresh": 1, "refresh": 1,
"regex": "", "regex": "",
"skipUrlSync": false, "skipUrlSync": false,

View File

@ -198,8 +198,8 @@ where
// Update the metrics after all the validation is finished // Update the metrics after all the validation is finished
tracing::trace!("verified block"); tracing::trace!("verified block");
metrics::gauge!("block.verified.block.height", height.0 as _); metrics::gauge!("zcash.chain.verified.block.height", height.0 as _);
metrics::counter!("block.verified.block.count", 1); metrics::counter!("zcash.chain.verified.block.total", 1);
// Finally, submit the block for contextual verification. // Finally, submit the block for contextual verification.
let new_outputs = Arc::try_unwrap(known_utxos) let new_outputs = Arc::try_unwrap(known_utxos)

View File

@ -364,7 +364,7 @@ where
let peer_tx = peer_tx.with(move |msg: Message| { let peer_tx = peer_tx.with(move |msg: Message| {
// Add a metric for outbound messages. // Add a metric for outbound messages.
// XXX add a dimension tagging message metrics by type // XXX add a dimension tagging message metrics by type
metrics::counter!("peer.outbound_messages", 1, "addr" => addr.to_string()); metrics::counter!("zcash.net.out.messages", 1, "addr" => addr.to_string());
// We need to use future::ready rather than an async block here, // We need to use future::ready rather than an async block here,
// because we need the sink to be Unpin, and the With<Fut, ...> // because we need the sink to be Unpin, and the With<Fut, ...>
// returned by .with is Unpin only if Fut is Unpin, and the // returned by .with is Unpin only if Fut is Unpin, and the
@ -380,7 +380,7 @@ where
if msg.is_ok() { if msg.is_ok() {
// XXX add a dimension tagging message metrics by type // XXX add a dimension tagging message metrics by type
metrics::counter!( metrics::counter!(
"inbound_messages", "zcash.net.in.messages",
1, 1,
"addr" => addr.to_string(), "addr" => addr.to_string(),
); );

View File

@ -386,7 +386,7 @@ where
let num_peers = num_ready + num_unready; let num_peers = num_ready + num_unready;
metrics::gauge!("pool.num_ready", num_ready as f64); metrics::gauge!("pool.num_ready", num_ready as f64);
metrics::gauge!("pool.num_unready", num_unready as f64); metrics::gauge!("pool.num_unready", num_unready as f64);
metrics::gauge!("pool.num_peers", num_peers as f64); metrics::gauge!("zcash.net.peers", num_peers as f64);
} }
} }

View File

@ -117,7 +117,7 @@ impl Encoder<Message> for Codec {
} }
if let Some(label) = self.builder.metrics_label.clone() { if let Some(label) = self.builder.metrics_label.clone() {
metrics::counter!("bytes.written", (body_length + HEADER_LEN) as u64, "addr" => label); metrics::counter!("zcash.net.out.bytes.total", (body_length + HEADER_LEN) as u64, "addr" => label);
} }
use Message::*; use Message::*;
@ -366,7 +366,7 @@ impl Decoder for Codec {
} }
if let Some(label) = self.builder.metrics_label.clone() { if let Some(label) = self.builder.metrics_label.clone() {
metrics::counter!("bytes.read", (body_len + HEADER_LEN) as u64, "addr" => label); metrics::counter!("zcash.net.in.bytes.total", (body_len + HEADER_LEN) as u64, "addr" => label);
} }
// Reserve buffer space for the expected body and the following header. // Reserve buffer space for the expected body and the following header.