diff --git a/opentelemetry-otlp/CHANGELOG.md b/opentelemetry-otlp/CHANGELOG.md index bc8046f9ad..dc859dd542 100644 --- a/opentelemetry-otlp/CHANGELOG.md +++ b/opentelemetry-otlp/CHANGELOG.md @@ -2,6 +2,8 @@ ## vNext +- The `OTEL_EXPORTER_OTLP_TIMEOUT`, `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT`, `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT` and `OTEL_EXPORTER_OTLP_LOGS_TIMEOUT` are changed from seconds to miliseconds. + ## 0.28.0 Released 2025-Feb-10 diff --git a/opentelemetry-otlp/src/exporter/http/mod.rs b/opentelemetry-otlp/src/exporter/http/mod.rs index 650358533e..10342a858a 100644 --- a/opentelemetry-otlp/src/exporter/http/mod.rs +++ b/opentelemetry-otlp/src/exporter/http/mod.rs @@ -120,7 +120,7 @@ impl HttpExporterBuilder { .or(env::var(OTEL_EXPORTER_OTLP_TIMEOUT).ok()) { Some(val) => match val.parse() { - Ok(seconds) => Duration::from_secs(seconds), + Ok(seconds) => Duration::from_millis(seconds), Err(_) => self.exporter_config.timeout, }, None => self.exporter_config.timeout, diff --git a/opentelemetry-otlp/src/exporter/mod.rs b/opentelemetry-otlp/src/exporter/mod.rs index bec1c809bb..219ea76387 100644 --- a/opentelemetry-otlp/src/exporter/mod.rs +++ b/opentelemetry-otlp/src/exporter/mod.rs @@ -52,7 +52,7 @@ const OTEL_EXPORTER_OTLP_PROTOCOL_HTTP_JSON: &str = "http/json"; /// Max waiting time for the backend to process each signal batch, defaults to 10 seconds. pub const OTEL_EXPORTER_OTLP_TIMEOUT: &str = "OTEL_EXPORTER_OTLP_TIMEOUT"; /// Default max waiting time for the backend to process each signal batch. -pub const OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT: u64 = 10; +pub const OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT: u64 = 10000; // Endpoints per protocol https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md #[cfg(feature = "grpc-tonic")] @@ -87,7 +87,7 @@ impl Default for ExportConfig { // don't use default_endpoint(protocol) here otherwise we // won't know if user provided a value protocol, - timeout: Duration::from_secs(OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT), + timeout: Duration::from_millis(OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT), } } } diff --git a/opentelemetry-otlp/src/exporter/tonic/mod.rs b/opentelemetry-otlp/src/exporter/tonic/mod.rs index 9e2b54c631..3b4bf03d42 100644 --- a/opentelemetry-otlp/src/exporter/tonic/mod.rs +++ b/opentelemetry-otlp/src/exporter/tonic/mod.rs @@ -200,7 +200,7 @@ impl TonicExporterBuilder { .or(env::var(OTEL_EXPORTER_OTLP_TIMEOUT).ok()) { Some(val) => match val.parse() { - Ok(seconds) => Duration::from_secs(seconds), + Ok(seconds) => Duration::from_millis(seconds), Err(_) => config.timeout, }, None => config.timeout,