Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename prometheus registry and metrics for better consistency #373

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metrics/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) struct Core {

impl Default for Core {
fn default() -> Self {
let mut reg = Registry::default();
let mut reg = Registry::with_prefix("ceramic_one");
Core {
bitswap_metrics: bitswap::Metrics::new(&mut reg),
libp2p_metrics: libp2p::metrics::Metrics::new(&mut reg),
Expand Down
6 changes: 1 addition & 5 deletions one/src/http_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ impl Metrics {
api_version: ceramic_api_server::API_VERSION,
kubo_api_version: ceramic_kubo_rpc_server::API_VERSION,
});
sub_registry.register(
"http_api",
"Information about the Ceramic and Kubo APIs",
info,
);
sub_registry.register("info", "Information about the Ceramic and Kubo APIs", info);

Self {
requests,
Expand Down
10 changes: 5 additions & 5 deletions store/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ impl From<&StorageQuery> for QueryLabels {
pub struct Metrics {
key_value_insert_count: Counter,

store_query_durations: Family<QueryLabels, Histogram>,
query_durations: Family<QueryLabels, Histogram>,
}

impl Metrics {
/// Register and construct Metrics
pub fn register(registry: &mut Registry) -> Self {
let sub_registry = registry.sub_registry_with_prefix("ceramic_store");
let sub_registry = registry.sub_registry_with_prefix("store");

register!(
key_value_insert_count,
Expand All @@ -59,7 +59,7 @@ impl Metrics {
);

register!(
store_query_durations,
query_durations,
"Durations of store queries in seconds",
Family::<QueryLabels, Histogram>::new_with_constructor(|| {
Histogram::new(exponential_buckets(0.005, 2.0, 20))
Expand All @@ -69,7 +69,7 @@ impl Metrics {

Self {
key_value_insert_count,
store_query_durations,
query_durations,
}
}
}
Expand All @@ -83,7 +83,7 @@ impl Recorder<InsertEvent> for Metrics {
impl Recorder<StorageQuery> for Metrics {
fn record(&self, event: &StorageQuery) {
let labels: QueryLabels = event.into();
self.store_query_durations
self.query_durations
.get_or_create(&labels)
.observe(event.duration.as_secs_f64());
}
Expand Down
Loading