feat(exporter): Implement OTLP JSON exporters for HTTP transport
Description
This PR adds JSON-based OTLP exporters to complement the existing Protobuf-based exporters. Many services and backends support the JSON format for OTLP data, and this implementation provides a standards-compliant way to export telemetry data in JSON format over HTTP.
The implementation follows the OpenTelemetry Protocol specification for JSON encoding and includes support for all telemetry signals (traces, metrics, and logs). The code structure mirrors the existing Protobuf exporters for consistency and ease of maintenance.
Fixes #1003
Type of change
- [x] New feature (non-breaking change which adds functionality)
- [x] This change requires a documentation update
How Has This Been Tested?
- [x] Unit tests for all exporters (traces, metrics, logs)
- [x] Integration tests verifying proper encoding and transport
- [x] Compatibility tests with the OpenTelemetry Protocol specification
- [x] Tests for environment variable configuration
- [x] Tests for error handling and retry logic
Does This PR Require a Contrib Repo Change?
- [ ] Yes. - Link to PR:
- [x] No.
Checklist:
- [x] Followed the style guidelines of this project
- [x] Changelogs have been updated
- [x] Unit tests have been added
- [ ] Documentation has been updated
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: andrewlwn77 (9abf25caa7ab15edbbc31d31232ce680d50bfae1, 48a87c647b3bb0e4a5246bcc2f582559f31520ef, 1cacc8413cd2096df2e8e00fdc662fffe71427ea)
Can you add encodie without base64 for trace/span ids so this can be written to a file ?
OTLP JSON file needs a regular id with hex encoding, not base64.
According to the specification the ids must be hex string and not base64
The traceId and spanId byte arrays are represented as case-insensitive hex-encoded strings; they are not base64-encoded as is defined in the standard Protobuf JSON Mapping. Hex encoding is used for traceId and spanId fields in all OTLP Protobuf messages, e.g., the Span, Link, LogRecord, etc. messages. For example, the traceId field in a Span can be represented like this: { “traceId”: “5B8EFFF798038103D269B633813FC60C”, … }
https://opentelemetry.io/docs/specs/otlp/
looking forward to this being resolved! it really helps in a proxy scenario where you want to use plain lua or have a python interpreter but you can't add grpc to it.
Hi, sorry I left some comments on #4556 instead of here by accident.
You may consider using https://pypi.org/project/otlp-test-data/ , a small project I made to generate all conceivable "weird" inputs.
That includes the JSON flavour of OTLP serialisation, to the best of my understanding.
I could be wrong on some details, PRs are welcome :)