Skip to content

Commit b07037e

Browse files
committed
refactor: use duration instead of _secs in config
1 parent 6b9a312 commit b07037e

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

config/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ key_store.mapping_key = "RelevantOracleMappingAddress"
198198
## Configuration for OpenTelemetry ##
199199
[opentelemetry]
200200

201-
# Timeout in seconds for the OpenTelemetry exporter
202-
exporter_timeout_secs = 3
201+
# Timeout duration for the OpenTelemetry exporter
202+
exporter_timeout_duration = "3s"
203203

204204
# Endpoint URL for the OpenTelemetry exporter
205205
exporter_endpoint = "http://127.0.0.1:4317"

src/agent/config.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ use {
1313
File,
1414
},
1515
serde::Deserialize,
16-
std::path::Path,
16+
std::{
17+
path::Path,
18+
time::Duration,
19+
},
1720
};
1821

1922
/// Configuration for all components of the Agent
@@ -88,6 +91,7 @@ impl Default for ChannelCapacities {
8891

8992
#[derive(Deserialize, Debug)]
9093
pub struct OpenTelemetryConfig {
91-
pub exporter_timeout_secs: u64,
92-
pub exporter_endpoint: String,
94+
#[serde(with = "humantime_serde")]
95+
pub exporter_timeout_duration: Duration,
96+
pub exporter_endpoint: String,
9397
}

src/bin/agent.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use {
1414
std::{
1515
io::IsTerminal,
1616
path::PathBuf,
17-
time::Duration,
1817
},
1918
tracing_subscriber::{
2019
prelude::*,
@@ -65,9 +64,7 @@ async fn main() -> Result<()> {
6564
let otlp_exporter = opentelemetry_otlp::new_exporter()
6665
.tonic()
6766
.with_endpoint(&opentelemetry_config.exporter_endpoint)
68-
.with_timeout(Duration::from_secs(
69-
opentelemetry_config.exporter_timeout_secs,
70-
));
67+
.with_timeout(opentelemetry_config.exporter_timeout_duration);
7168

7269
// Set up the OpenTelemetry tracer
7370
let tracer = opentelemetry_otlp::new_pipeline()

0 commit comments

Comments
 (0)