Skip to content

Commit 5dbcb71

Browse files
committed
telemetry export/toggle
1 parent 8b68132 commit 5dbcb71

File tree

4 files changed

+275
-31
lines changed

4 files changed

+275
-31
lines changed

examples/agent-oauth2.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ version = "1.0.0"
77
log_level = "info"
88

99
[telemetry]
10-
endpoint = "https://collector.example.com:4317" # OTLP gRPC endpoint
10+
endpoint = "https://collector.example.com" # OTLP HTTP/JSON endpoint (will append /v1/metrics)
1111
interval_seconds = 30
1212
timeout_seconds = 10
1313
insecure = false
14+
enabled = true # Set to false to disable metrics export
1415

1516
# Configure OAuth2 authentication for telemetry endpoint
1617
[telemetry.auth]

examples/agent.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ version = "1.0.0"
44
log_level = "info"
55

66
[telemetry]
7-
endpoint = "http://localhost:4317" # OTLP gRPC endpoint
7+
endpoint = "http://localhost:4317" # OTLP HTTP/JSON endpoint
88
interval_seconds = 60
99
timeout_seconds = 10
1010
insecure = false
11+
enabled = true # Set to false to disable metrics export
1112

1213
[clamav]
1314
# Unix socket (preferred on Linux/macOS)

src/config/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ pub struct TelemetryConfig {
3535
pub auth: Option<AuthConfig>,
3636
#[serde(default = "default_service_name")]
3737
pub service_name: String,
38+
#[serde(default = "default_enabled")]
39+
pub enabled: bool,
3840
}
3941

4042
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -82,6 +84,10 @@ fn default_service_name() -> String {
8284
"clamreef".to_string()
8385
}
8486

87+
fn default_enabled() -> bool {
88+
true
89+
}
90+
8591
fn default_interval() -> u64 {
8692
60
8793
}
@@ -449,6 +455,7 @@ schedule = "0 0 */6 * * *"
449455
insecure: false,
450456
auth: None,
451457
service_name: "clamreef".to_string(),
458+
enabled: true,
452459
},
453460
clamav: ClamAVConfig {
454461
socket_path: None,
@@ -483,6 +490,7 @@ schedule = "0 0 */6 * * *"
483490
insecure: false,
484491
auth: None,
485492
service_name: "clamreef".to_string(),
493+
enabled: true,
486494
},
487495
clamav: ClamAVConfig {
488496
socket_path: Some("/var/run/clamav/clamd.ctl".to_string()),
@@ -525,6 +533,7 @@ schedule = "0 0 */6 * * *"
525533
insecure: false,
526534
auth: None,
527535
service_name: "clamreef".to_string(),
536+
enabled: true,
528537
},
529538
clamav: ClamAVConfig {
530539
socket_path: Some("/var/run/clamav/clamd.ctl".to_string()),
@@ -567,6 +576,7 @@ schedule = "0 0 */6 * * *"
567576
insecure: false,
568577
auth: None,
569578
service_name: "clamreef".to_string(),
579+
enabled: true,
570580
},
571581
clamav: ClamAVConfig {
572582
socket_path: Some("/var/run/clamav/clamd.ctl".to_string()),
@@ -718,6 +728,7 @@ schedule = "0 0 */6 * * *"
718728
insecure: true,
719729
auth: None,
720730
service_name: "clamreef".to_string(),
731+
enabled: true,
721732
},
722733
clamav: ClamAVConfig {
723734
socket_path: None,

0 commit comments

Comments
 (0)