Skip to content

Commit fe55dc0

Browse files
committed
Option to disable heavy metrics
1 parent 901eb7e commit fe55dc0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

config.example.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ path = "/var/run/corrosion/admin.sock"
1515

1616
[telemetry]
1717
prometheus.addr = "127.0.0.1:9090"
18+
# Disable heavy metrics collection
19+
# Set to true to disable on resource-constrained VMs
20+
# disable-heavy-metrics = false
1821

1922
[log]
2023
format = "json"

crates/corro-agent/src/agent/run_root.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ async fn run(
139139
transport.clone(),
140140
tripwire.clone(),
141141
));
142-
spawn_counted(metrics::heavy_metrics_loop(agent.clone(), tripwire.clone()));
142+
143+
if !agent.config().telemetry.disable_heavy_metrics {
144+
spawn_counted(metrics::heavy_metrics_loop(agent.clone(), tripwire.clone()));
145+
}
143146
spawn_counted(handlers::handle_gossip_to_send(
144147
transport.clone(),
145148
to_send_rx,

crates/corro-types/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ pub struct Config {
8686
pub struct TelemetryConfig {
8787
pub prometheus: Option<PrometheusConfig>,
8888
pub open_telemetry: Option<OtelConfig>,
89+
#[serde(default)]
90+
pub disable_heavy_metrics: bool,
8991
}
9092

9193
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -422,6 +424,7 @@ impl ConfigBuilder {
422424
.prometheus_addr
423425
.map(|bind_addr| PrometheusConfig { bind_addr }),
424426
open_telemetry: None,
427+
disable_heavy_metrics: false,
425428
};
426429

427430
if self.api_addr.is_empty() {

0 commit comments

Comments
 (0)