Skip to content

Commit

Permalink
change metrics visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Oct 28, 2024
1 parent 905f459 commit f043db9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion yellowstone-grpc-geyser/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ impl GrpcService {
parent: entry.parent_slot,
status,
})));
metrics::MISSED_STATUS_MESSAGE.inc();
metrics::missed_status_message_inc(status);
}
}
}
Expand Down
27 changes: 20 additions & 7 deletions yellowstone-grpc-geyser/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use {
server::conn::auto::Builder as ServerBuilder,
},
log::{error, info},
prometheus::{IntCounter, IntCounterVec, IntGauge, IntGaugeVec, Opts, Registry, TextEncoder},
prometheus::{IntCounterVec, IntGauge, IntGaugeVec, Opts, Registry, TextEncoder},
solana_sdk::clock::Slot,
std::{
collections::{hash_map::Entry as HashMapEntry, HashMap},
Expand Down Expand Up @@ -63,7 +63,10 @@ lazy_static::lazy_static! {
&["endpoint", "subscription"]
).unwrap();

pub static ref MISSED_STATUS_MESSAGE: IntCounter = IntCounter::new("missed_status_message_total", "Number of missed messages").unwrap();
static ref MISSED_STATUS_MESSAGE: IntCounterVec = IntCounterVec::new(
Opts::new("missed_status_message_total", "Number of missed messages by commitment"),
&["status"]
).unwrap();
}

#[derive(Debug)]
Expand Down Expand Up @@ -323,11 +326,7 @@ pub fn update_slot_status(status: SlotStatus, slot: u64) {

pub fn update_slot_plugin_status(status: CommitmentLevel, slot: u64) {
SLOT_STATUS_PLUGIN
.with_label_values(&[match status {
CommitmentLevel::Processed => "processed",
CommitmentLevel::Confirmed => "confirmed",
CommitmentLevel::Finalized => "finalized",
}])
.with_label_values(&[commitment_level_as_str(status)])
.set(slot as i64);
}

Expand All @@ -353,3 +352,17 @@ pub fn update_subscriptions(endpoint: &str, old: Option<&Filter>, new: Option<&F
}
}
}

pub fn missed_status_message_inc(status: CommitmentLevel) {
MISSED_STATUS_MESSAGE
.with_label_values(&[commitment_level_as_str(status)])
.inc()
}

const fn commitment_level_as_str(commitment: CommitmentLevel) -> &'static str {
match commitment {
CommitmentLevel::Processed => "processed",
CommitmentLevel::Confirmed => "confirmed",
CommitmentLevel::Finalized => "finalized",
}
}

0 comments on commit f043db9

Please sign in to comment.