[feat]: Add OTLP HTTP/JSON traces exporter
Description
Adds a OTLP HTTP/JSON exporter. Currently only exports trace data, but can be expanded to add metrics and logs too.
Fixes #1003
NOTE: I've created as a draft to gather feedback and will add more tests. Also needs lint rules applied too.
Type of change
Please delete options that are not relevant.
- [x] New feature (non-breaking change which adds functionality)
- [x] This change requires a documentation update
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [ ] Add simple Unit Test to verify JSON output, want to add more
Does This PR Require a Contrib Repo Change?
- [ ] Yes. - Link to PR:
- [x] No.
Checklist:
- [ ] Followed the style guidelines of this project
- [ ] Changelogs have been updated
- [ ] Unit tests have been added
- [ ] Documentation has been updated
exporter-otlp-json can be just copy of exporter-otlp-proto-http and just replace these lines:
https://github.com/open-telemetry/opentelemetry-python/blob/2b9dcfc5d853d1c10176937a6bcaade54cda1a31/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/init.py#L136
https://github.com/open-telemetry/opentelemetry-python/blob/2b9dcfc5d853d1c10176937a6bcaade54cda1a31/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/init.py#L181
https://github.com/open-telemetry/opentelemetry-python/blob/2b9dcfc5d853d1c10176937a6bcaade54cda1a31/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/init.py#L138
into json_format.MessageToJson(encode_xxx(...), indent=None).
Or can we just add json option to otlp-proto-http exporter? They are very close.
How other languages implement them?
@MikeGoldsmith are you still working on this PR?
Hi @ocelotl - I had the intention of keeping this going but have struggled to get back to it.
It's probably best to close this PR and unassign me from the issue. If I find I get more time and it's still available, I'll put my hand up again.
Thanks