From 65a7215458038d1af0d627e834f1b586b375f8b6 Mon Sep 17 00:00:00 2001 From: Lars Michelsen Date: Tue, 16 Jul 2024 17:20:21 +0200 Subject: [PATCH] Align HTTP metric exporter timeout with other exporters It's desirable to have a common API across all exporters. Since the previously existing timeout_millis argument wasn't used anyways, it should not be an issue to change the default value here. The None case will fall back to the object level timeout, which is the same as the previous default argument value. --- .../exporter/otlp/proto/http/metric_exporter/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py index 9f7cee5eff..260df9570e 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py @@ -216,7 +216,7 @@ def _retryable(resp: requests.Response) -> bool: def export( self, metrics_data: MetricsData, - timeout_millis: float = 10_000, + timeout_millis: Optional[float] = None, **kwargs, ) -> MetricExportResult: if self._shutdown: @@ -225,7 +225,10 @@ def export( serialized_data = encode_metrics(metrics_data) return self._exporter.export_with_retry( - serialized_data.SerializeToString() + serialized_data.SerializeToString(), + timeout_sec=( + timeout_millis / 1000 if timeout_millis is not None else None + ), ) def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None: