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

Revert "chore(metrics): add unit to certain metrics" #2068

Merged
merged 1 commit into from
Sep 2, 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
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
Loading