-
Notifications
You must be signed in to change notification settings - Fork 722
Description
Describe your environment
OS: (e.g, MacOS)
Python version: (e.g., Python 3.11.x)
SDK version: (e.g., 1.35.0)
API version: (e.g., 1.35.0)
What happened?
v1.35.0
of opentelemetry-api
added a non-optional argument (timeout_sec
) to an existing internal function, more specifically:
def _export(self, serialized_data: bytes, timeout_sec: float): ...
in
.../opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py
I know that internal functions aren't bound by the same semver
stability contract as public apis, but it would have been nice to add that argument as optional
or at least add a default value to it. :D
Cheers,
Steps to Reproduce
Subclass OTLPSpanExporter
and intercept _export(...)
.
Expected Result
Works exactly like v1.34.x
and before.
Actual Result
Breaks with:
File "/var/task/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py", line 165, in export
resp = self._export(serialized_data, deadline_sec - time())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: OTLPExporter._export() takes 2 positional arguments but 3 were given
Additional context
The reason why we are intercepting _export()
is because the http export headers are dynamic in our application, as in they depend on the trace_id
which depends on the request_id
, and consequently we need to dynamically set those headers write before the export.
Would you like to implement a fix?
None