From 7a5d2fe1328a3580836921d5af84c84823b14e92 Mon Sep 17 00:00:00 2001 From: Paresh Joshi Date: Fri, 21 Nov 2025 10:06:41 +0530 Subject: [PATCH] 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. --- .../exporter/otlp/proto/grpc/_log_exporter/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py index 63d8ac9cfb..439c31aed6 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py @@ -100,7 +100,7 @@ def __init__( insecure=insecure, credentials=credentials, headers=headers or environ.get(OTEL_EXPORTER_OTLP_LOGS_HEADERS), - timeout=timeout or environ_timeout, + timeout=timeout if timeout is not None else environ_timeout, compression=compression, stub=LogsServiceStub, result=LogRecordExportResult, @@ -110,7 +110,7 @@ def __init__( def _translate_data( self, data: Sequence[ReadableLogRecord] ) -> ExportLogsServiceRequest: - return encode_logs(data) + return ExportLogsServiceRequest(resource_logs=encode_logs(data)) def export( # type: ignore [reportIncompatibleMethodOverride] self,