open-telemetry / open-telemetry/opentelemetry-python
Retry 413 / payload too large errors in OTLP batch exporter
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 19
Description
Is your feature request related to a problem?
Many backends have size limits. If you try to send too large of a payload it may get dropped on the floor. This is somewhat mitigated by setting a batch size limit (in terms of number of spans) but that (1) is not at the byte size level and (2) you need to know ahead of time what your backend's limit is.
Describe the solution you'd like
I would the SDK to retry on this failure code by reducing the payload size (e.g. split it into two exports) until it's accepted or a single span is rejected.
Ideally we'd have a way for the backend to communicate back it's limit and the SDK could even store that and avoid hitting the error in the future, but I think that would require agreement at the OTEL spec level for an expected response payload body that includes the maximum allowed size. Implementing a retry in the Python SDK can be a good step in that direction.
Describe alternatives you've considered
No response
Additional Context
No response
Would you like to implement a fix?
Yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Python SDK's OTLP batch exporter and its handling of HTTP 413 or payload-too-large responses; the issue names no specific files or tests. Trace the export and retry entry points, then determine how payloads can be split and retried until accepted or reduced to a single rejected span. Done means oversized payloads are handled as described without losing acceptable data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100