diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b80ef9ec32..b896da235d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Overwrite logging.config.fileConfig and logging.config.dictConfig to ensure the OTLP `LogHandler` remains attached to the root logger. Fix a bug that can cause a deadlock to occur over `logging._lock` in some cases ([#4636](https://github.com/open-telemetry/opentelemetry-python/pull/4636)). +- otlp-http-exporter: set default value for param `timeout_sec` in `_export` method + ([#4691](https://github.com/open-telemetry/opentelemetry-python/pull/4691)) - Update OTLP gRPC/HTTP exporters: calling shutdown will now interrupt exporters that are sleeping before a retry attempt, and cause them to return failure immediately. @@ -39,7 +41,7 @@ can cause a deadlock to occur over `logging._lock` in some cases ([#4636](https: - Update logger level to NOTSET in logs example ([#4637](https://github.com/open-telemetry/opentelemetry-python/pull/4637)) - Logging API accepts optional `context`; deprecates `trace_id`, `span_id`, `trace_flags`. - ([#4597](https://github.com/open-telemetry/opentelemetry-python/pull/4597)) and + ([#4597](https://github.com/open-telemetry/opentelemetry-python/pull/4597)) and ([#4668](https://github.com/open-telemetry/opentelemetry-python/pull/4668)) - sdk: use context instead of trace_id,span_id for initializing LogRecord ([#4653](https://github.com/open-telemetry/opentelemetry-python/pull/4653)) diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py index 4c8b4de6004..765bc5c7f5b 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py @@ -126,7 +126,9 @@ def __init__( ) self._shutdown = False - def _export(self, serialized_data: bytes, timeout_sec: float): + def _export( + self, serialized_data: bytes, timeout_sec: Optional[float] = None + ): data = serialized_data if self._compression == Compression.Gzip: gzip_data = BytesIO() @@ -136,6 +138,9 @@ def _export(self, serialized_data: bytes, timeout_sec: float): elif self._compression == Compression.Deflate: data = zlib.compress(serialized_data) + if timeout_sec is None: + timeout_sec = self._timeout + # By default, keep-alive is enabled in Session's request # headers. Backends may choose to close the connection # while a post happens which causes an unhandled 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 486344753a0..3b7079f7fc2 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 @@ -172,7 +172,9 @@ def __init__( ) self._shutdown = False - def _export(self, serialized_data: bytes, timeout_sec: float): + def _export( + self, serialized_data: bytes, timeout_sec: Optional[float] = None + ): data = serialized_data if self._compression == Compression.Gzip: gzip_data = BytesIO() @@ -182,6 +184,9 @@ def _export(self, serialized_data: bytes, timeout_sec: float): elif self._compression == Compression.Deflate: data = zlib.compress(serialized_data) + if timeout_sec is None: + timeout_sec = self._timeout + # By default, keep-alive is enabled in Session's request # headers. Backends may choose to close the connection # while a post happens which causes an unhandled diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py index 8b97a651d4f..8ea73d4c0f9 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py @@ -124,7 +124,9 @@ def __init__( ) self._shutdown = False - def _export(self, serialized_data: bytes, timeout_sec: float): + def _export( + self, serialized_data: bytes, timeout_sec: Optional[float] = None + ): data = serialized_data if self._compression == Compression.Gzip: gzip_data = BytesIO() @@ -134,6 +136,9 @@ def _export(self, serialized_data: bytes, timeout_sec: float): elif self._compression == Compression.Deflate: data = zlib.compress(serialized_data) + if timeout_sec is None: + timeout_sec = self._timeout + # By default, keep-alive is enabled in Session's request # headers. Backends may choose to close the connection # while a post happens which causes an unhandled