open-telemetry / open-telemetry/opentelemetry-python
OTLP HTTP Exporter Should Parse response based on content-type header
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 19
Description
Describe your environment
OS: Linux
Python version: 3.12
SDK version: 1.24
API version: 1.24
What happened?
Check out https://github.com/open-telemetry/opentelemetry-proto/issues/640
The response from the HTTP OTLP Exporters should be parsed based on the content-type header in the response.
Currently it prints out resp.text
But that mangles things a bit if the response is proto encoded.
I think the response can also be in json ?
For reference here is how the collector parses proto
Steps to Reproduce
Follow the instructions to call telemetry.googleapis.com here: https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/tree/main/samples/otlptrace via python3 example_http.py. Be sure to skip the step setting the environment variables export OTEL_RESOURCE_ATTRIBUTES="gcp.project_id=<project-id>".
You will see an error returned that looks a bit weird because it is proto encoded, but it is just printed as text.
Expected Result
Expect error response to be parsed based on content-type encoding
Actual Result
Error response always parsed as text
Additional context
No response
Would you like to implement a fix?
None
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 in exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/init.py at the response handling linked in the issue. Reproduce the behavior with the telemetry.googleapis.com example_http.py instructions, then inspect how the HTTP exporter currently uses resp.text. Done means error responses are interpreted according to their content-type rather than always displayed as text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100