-
Notifications
You must be signed in to change notification settings - Fork 761
Description
Describe your environment
OS: (e.g, Ubuntu)
Python version: (e.g., Python 3.9.10)
SDK version: (e.g., 1.25.0)
API version: (e.g., 1.25.0)
What happened?
Describe the bug
The OTLPLogExporter (gRPC) fails to export logs because _translate_data returns the raw result of encode_logs (a list of ResourceLogs) instead of wrapping it in the ExportLogsServiceRequest envelope.
This results in a TypeError when the gRPC stub receives the data, as it expects the service request object.
To Reproduce
- Configure the OTLP Log Exporter with gRPC.
- Attempt to export a log batch.
- The export fails.
Expected behavior
The exporter should wrap the encoded logs in ExportLogsServiceRequest(resource_logs=...) before passing them to the stub.
Additional context
Also, the timeout argument in __init__ incorrectly overrides an explicit 0 value with the environment variable due to boolean or usage.
Steps to Reproduce
#Steps to Reproduce
Inspect _translate_data in opentelemetry/exporter/otlp/proto/grpc/exporter.py. It returns the raw output of encode_logs(data) directly. The gRPC stub expects an ExportLogsServiceRequest envelope, so this causes a type mismatch failure during export.
Expected Result The _translate_data method should return an ExportLogsServiceRequest object containing the encoded logs, not the raw logs list.
Expected Result
_translate_data should return an ExportLogsServiceRequest wrapper object. Also, passing timeout=0 should be respected as 0.
Actual Result
_translate_data returns a raw list (ResourceLogs), causing the export to fail with a type error. Also, timeout=0 is treated as None and overwritten by the default.
Additional context
No response
Would you like to implement a fix?
Yes
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.