Skip to content

Commit

Permalink
Remove epoch label from Narwhal metrics (MystenLabs#7416)
Browse files Browse the repository at this point in the history
This can be creating too many cardinalities. For reading current epoch,
the Sui `current_epoch` metric can be used for now. We can add a narwhal
specific metric in future.
  • Loading branch information
mwtian authored Jan 15, 2023
1 parent f92b769 commit 8c8582a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions narwhal/node/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use axum::{http::StatusCode, routing::get, Extension, Router};
use config::{Epoch, WorkerId};
use config::WorkerId;
use crypto::PublicKey;
use multiaddr::Multiaddr;
use mysten_metrics::spawn_logged_monitored_task;
Expand All @@ -14,10 +14,8 @@ const METRICS_ROUTE: &str = "/metrics";
const PRIMARY_METRICS_PREFIX: &str = "narwhal_primary";
const WORKER_METRICS_PREFIX: &str = "narwhal_worker";

pub fn new_registry(epoch: Epoch) -> Registry {
let mut labels = HashMap::new();
labels.insert("epoch".to_string(), epoch.to_string());
Registry::new_custom(None, Some(labels)).unwrap()
pub fn new_registry() -> Registry {
Registry::new_custom(None, None).unwrap()
}

pub fn primary_metrics_registry(name: PublicKey) -> Registry {
Expand Down
2 changes: 1 addition & 1 deletion narwhal/node/src/primary_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl PrimaryNodeInner {
}

// create a new registry
let registry = new_registry(committee.load().epoch);
let registry = new_registry();

// create the channel to send the shutdown signal
let mut tx_shutdown = PreSubscribedBroadcastSender::new(NUM_SHUTDOWN_RECEIVERS);
Expand Down
4 changes: 2 additions & 2 deletions narwhal/node/src/worker_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl WorkerNodeInner {
(metrics, None)
} else {
// create a new registry
let registry = new_registry(committee.load().epoch);
let registry = new_registry();

(initialise_metrics(&registry), Some(registry))
};
Expand Down Expand Up @@ -265,7 +265,7 @@ impl WorkerNodes {
}

// create the registry first
let registry = new_registry(committee.load().epoch);
let registry = new_registry();

let metrics = initialise_metrics(&registry);

Expand Down

0 comments on commit 8c8582a

Please sign in to comment.