Skip to content

Commit 6a23c40

Browse files
committed
default timeout_sec
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
1 parent 57cb935 commit 6a23c40

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Overwrite logging.config.fileConfig and logging.config.dictConfig to ensure
1111
the OTLP `LogHandler` remains attached to the root logger. Fix a bug that
1212
can cause a deadlock to occur over `logging._lock` in some cases ([#4636](https://github.com/open-telemetry/opentelemetry-python/pull/4636)).
13+
- otlp-http-exporter: set default value for param `timeout_sec` in `_export` method
14+
([#4690](https://github.com/open-telemetry/opentelemetry-python/pull/4690))
1315

1416
## Version 1.35.0/0.56b0 (2025-07-11)
1517

@@ -31,7 +33,7 @@ can cause a deadlock to occur over `logging._lock` in some cases ([#4636](https:
3133
- Update logger level to NOTSET in logs example
3234
([#4637](https://github.com/open-telemetry/opentelemetry-python/pull/4637))
3335
- Logging API accepts optional `context`; deprecates `trace_id`, `span_id`, `trace_flags`.
34-
([#4597](https://github.com/open-telemetry/opentelemetry-python/pull/4597)) and
36+
([#4597](https://github.com/open-telemetry/opentelemetry-python/pull/4597)) and
3537
([#4668](https://github.com/open-telemetry/opentelemetry-python/pull/4668))
3638
- sdk: use context instead of trace_id,span_id for initializing LogRecord
3739
([#4653](https://github.com/open-telemetry/opentelemetry-python/pull/4653))

exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ def __init__(
124124
)
125125
self._shutdown = False
126126

127-
def _export(self, serialized_data: bytes, timeout_sec: float):
127+
def _export(
128+
self, serialized_data: bytes, timeout_sec: Optional[float] = None
129+
):
128130
data = serialized_data
129131
if self._compression == Compression.Gzip:
130132
gzip_data = BytesIO()
@@ -134,6 +136,9 @@ def _export(self, serialized_data: bytes, timeout_sec: float):
134136
elif self._compression == Compression.Deflate:
135137
data = zlib.compress(serialized_data)
136138

139+
if timeout_sec is None:
140+
timeout_sec = self._timeout
141+
137142
# By default, keep-alive is enabled in Session's request
138143
# headers. Backends may choose to close the connection
139144
# while a post happens which causes an unhandled

exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ def __init__(
170170
)
171171
self._shutdown = False
172172

173-
def _export(self, serialized_data: bytes, timeout_sec: float):
173+
def _export(
174+
self, serialized_data: bytes, timeout_sec: Optional[float] = None
175+
):
174176
data = serialized_data
175177
if self._compression == Compression.Gzip:
176178
gzip_data = BytesIO()
@@ -180,6 +182,9 @@ def _export(self, serialized_data: bytes, timeout_sec: float):
180182
elif self._compression == Compression.Deflate:
181183
data = zlib.compress(serialized_data)
182184

185+
if timeout_sec is None:
186+
timeout_sec = self._timeout
187+
183188
# By default, keep-alive is enabled in Session's request
184189
# headers. Backends may choose to close the connection
185190
# while a post happens which causes an unhandled

exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ def __init__(
122122
)
123123
self._shutdown = False
124124

125-
def _export(self, serialized_data: bytes, timeout_sec: float):
125+
def _export(
126+
self, serialized_data: bytes, timeout_sec: Optional[float] = None
127+
):
126128
data = serialized_data
127129
if self._compression == Compression.Gzip:
128130
gzip_data = BytesIO()
@@ -132,6 +134,9 @@ def _export(self, serialized_data: bytes, timeout_sec: float):
132134
elif self._compression == Compression.Deflate:
133135
data = zlib.compress(serialized_data)
134136

137+
if timeout_sec is None:
138+
timeout_sec = self._timeout
139+
135140
# By default, keep-alive is enabled in Session's request
136141
# headers. Backends may choose to close the connection
137142
# while a post happens which causes an unhandled

0 commit comments

Comments
 (0)