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

[Fix] Configure metrics compilation in root toml #3462

Merged
merged 4 commits into from
Jan 27, 2025
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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ name = "snarkos"
path = "snarkos/main.rs"

[features]
metrics = [ "snarkos-node-metrics", "snarkos-node/metrics" ]
default = [ "snarkos-node-metrics", "snarkos-node/metrics", "snarkos-cli/metrics" ]
vicsn marked this conversation as resolved.
Show resolved Hide resolved
history = [ "snarkos-node/history" ]
test_targets = [ "snarkos-cli/test_targets" ]

Expand Down
3 changes: 2 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license = "Apache-2.0"
edition = "2021"

[features]
default = [ "snarkos-node/metrics" ]
metrics = [ "dep:metrics", "snarkos-node/metrics" ]
test_targets = [ "snarkvm/test_targets" ]

[dependencies.aleo-std]
Expand Down Expand Up @@ -50,6 +50,7 @@ features = [ "serde", "rayon" ]
package = "snarkos-node-metrics"
path = "../node/metrics"
version = "=3.2.0"
optional = true

[dependencies.num_cpus]
version = "1"
Expand Down
3 changes: 3 additions & 0 deletions cli/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ pub struct Start {
pub logfile: PathBuf,

/// Enables the metrics exporter
#[cfg(feature = "metrics")]
#[clap(default_value = "false", long = "metrics")]
pub metrics: bool,
/// Specify the IP address and port for the metrics exporter
#[cfg(feature = "metrics")]
#[clap(long = "metrics-ip")]
pub metrics_ip: Option<SocketAddr>,

Expand Down Expand Up @@ -587,6 +589,7 @@ impl Start {
crate::helpers::check_validator_machine(node_type);

// Initialize the metrics.
#[cfg(feature = "metrics")]
if self.metrics {
metrics::initialize_metrics(self.metrics_ip);
}
Expand Down
50 changes: 25 additions & 25 deletions node/tcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@ async-trait = "0.1"
bytes = "1"
parking_lot = "0.12"

[dependencies.futures-util]
version = "0.3"
features = [ "sink" ]

[dependencies.metrics]
package = "snarkos-node-metrics"
path = "../metrics"
version = "=3.2.0"
optional = true

[dependencies.once_cell]
version = "1"
features = [ "parking_lot" ]

[dependencies.tokio]
version = "1.28"
features = [ "io-util", "net", "parking_lot", "rt", "sync", "time" ]

[dependencies.tokio-util]
version = "0.7"
features = [ "codec" ]

[dependencies.tracing]
version = "0.1"
default-features = false
[dependencies.futures-util]
version = "0.3"
features = [ "sink" ]

[dependencies.metrics]
package = "snarkos-node-metrics"
path = "../metrics"
version = "=3.2.0"
optional = true

[dependencies.once_cell]
version = "1"
features = [ "parking_lot" ]

[dependencies.tokio]
version = "1.28"
features = [ "io-util", "net", "parking_lot", "rt", "sync", "time" ]

[dependencies.tokio-util]
version = "0.7"
features = [ "codec" ]

[dependencies.tracing]
version = "0.1"
default-features = false

[dev-dependencies.tokio]
version = "1.28"
Expand Down