Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Contributor

@xrmx xrmx Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct but please add a test and also update it for all the signals. Said that OTLPExporterMixin has the same issue so without updating that too this won't change behavior. Also no idea how the grpc client will behave.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both requests and gRPC when a timeout is not set, they will wait forever for the server:

https://grpc.io/docs/guides/deadlines/#deadlines-on-the-client
https://requests.readthedocs.io/en/latest/user/advanced/#timeouts

I don't think we want that ? I think we should always set some upper bound..

An explicit timeout of 0 will cause an error from python requests library. I did not try it for grpc but it might be the same, have you tried it ?

My thinking is we should update the code to explicitly disallow (or ignore?) a timeout of 0, and also to update the code to set some upper bound on the timeout.. WDYT?

If you actually wanted this change you would also have to update this logic in all the exporters (we have similar logic for HTTP):

https://github.com/open-telemetry/opentelemetry-python/blob/main/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py#L388C9-L388C21

compression=compression,
stub=LogsServiceStub,
result=LogRecordExportResult,
Expand All @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about that:

def encode_logs(
    batch: Sequence[ReadableLogRecord],
) -> ExportLogsServiceRequest:
    return ExportLogsServiceRequest(resource_logs=_encode_resource_logs(batch))

Do tests pass?


def export( # type: ignore [reportIncompatibleMethodOverride]
self,
Expand Down
Loading