Skip to content

Commit 7a5d2fe

Browse files
authored
Fix OTLP gRPC log exporter request wrapper and timeout precedence
This commit fixes a critical bug in the OTLP gRPC log exporter where `_translate_data` was returning raw `ResourceLogs` instead of wrapping them in `ExportLogsServiceRequest`. This caused gRPC export calls to fail with a type error. Additionally, this fixes the `timeout` argument initialization. Previously, passing `timeout=0` would be treated as None due to boolean evaluation; it now checks `if timeout is not None` to correctly respect explicit zero timeouts.
1 parent 546e47b commit 7a5d2fe

File tree

1 file changed

+2
-2
lines changed
  • exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(
100100
insecure=insecure,
101101
credentials=credentials,
102102
headers=headers or environ.get(OTEL_EXPORTER_OTLP_LOGS_HEADERS),
103-
timeout=timeout or environ_timeout,
103+
timeout=timeout if timeout is not None else environ_timeout,
104104
compression=compression,
105105
stub=LogsServiceStub,
106106
result=LogRecordExportResult,
@@ -110,7 +110,7 @@ def __init__(
110110
def _translate_data(
111111
self, data: Sequence[ReadableLogRecord]
112112
) -> ExportLogsServiceRequest:
113-
return encode_logs(data)
113+
return ExportLogsServiceRequest(resource_logs=encode_logs(data))
114114

115115
def export( # type: ignore [reportIncompatibleMethodOverride]
116116
self,

0 commit comments

Comments
 (0)