Skip to content

Commit

Permalink
Merge pull request #2068 from RolandSherwin/revert_metrics_unit
Browse files Browse the repository at this point in the history
Revert "chore(metrics): add unit to certain metrics"
  • Loading branch information
jacderida authored Sep 2, 2024
2 parents 811617b + 2abb2c9 commit 338a194
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
8 changes: 3 additions & 5 deletions sn_networking/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use libp2p::metrics::{Metrics as Libp2pMetrics, Recorder};
use prometheus_client::metrics::family::Family;
use prometheus_client::{
metrics::{counter::Counter, gauge::Gauge},
registry::{Registry, Unit},
registry::Registry,
};
use sysinfo::{Pid, ProcessRefreshKind, System};
use tokio::time::Duration;
Expand Down Expand Up @@ -118,18 +118,16 @@ impl NetworkMetricsRecorder {
);

let process_memory_used_mb = Gauge::default();
sub_registry.register_with_unit(
sub_registry.register(
"process_memory_used_mb",
"Memory used by the process in MegaBytes",
Unit::Other("MegaByte".to_string()),
process_memory_used_mb.clone(),
);

let process_cpu_usage_percentage = Gauge::default();
sub_registry.register_with_unit(
sub_registry.register(
"process_cpu_usage_percentage",
"The percentage of CPU used by the process. Value is from 0-100",
Unit::Other("Percentage".to_string()),
process_cpu_usage_percentage.clone(),
);

Expand Down
11 changes: 4 additions & 7 deletions sn_node/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use prometheus_client::{
gauge::Gauge,
histogram::{exponential_buckets, Histogram},
},
registry::{Registry, Unit},
registry::Registry,
};
use sn_networking::Instant;

Expand Down Expand Up @@ -102,26 +102,23 @@ impl NodeMetricsRecorder {
);

let current_reward_wallet_balance = Gauge::default();
sub_registry.register_with_unit(
sub_registry.register(
"current_reward_wallet_balance",
"The number of Nanos in the node reward wallet",
Unit::Other("Nano".to_string()),
current_reward_wallet_balance.clone(),
);

let total_forwarded_rewards = Gauge::default();
sub_registry.register_with_unit(
sub_registry.register(
"total_forwarded_rewards",
"The cumulative number of Nanos forwarded by the node",
Unit::Other("Nano".to_string()),
total_forwarded_rewards.clone(),
);

let uptime = Gauge::default();
sub_registry.register_with_unit(
sub_registry.register(
"uptime",
"The uptime of the node in seconds",
Unit::Seconds,
uptime.clone(),
);

Expand Down

0 comments on commit 338a194

Please sign in to comment.