Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[OPIK-1109] Add JSON support to OpenTelemetry traces ingestion #1394

Merged
merged 9 commits into from
Feb 26, 2025

Conversation

ldaugusto
Copy link
Contributor

Details

Extending Otel support for JSON payloads. Nothing too fancy, the Otel library accepts merging JSON content into a the same object you'd use for Protobuf, so the work is just making both paths converge into a single process path asap.

I'm addind as defensive programming a JSON sanitization at the beginning as the Gson library was triggering lots of exceptions from unescaped json strings.

Issues

Resolves #

Testing

Documentation

@ldaugusto ldaugusto requested a review from a team as a code owner February 26, 2025 15:43
@Path("/traces")
@POST
@Consumes("application/json")
public Response receiveJsonTraces(@RequestBody String jsonPayload) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it would be better to create a CustomDeserializer to do all this and keep the controller simple, just receiving the Parsed Object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The payloads can be very very different depending on the integration, we can't predict them, so I'm just repassing the parsing to the otel-protobuf library

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I get what you meant, it's a very neat solution, thanks!

thiagohora
thiagohora previously approved these changes Feb 26, 2025
@ldaugusto ldaugusto merged commit 034839f into main Feb 26, 2025
8 checks passed
@ldaugusto ldaugusto deleted the daniel/opik-1109-otel-json-support branch February 26, 2025 17:41
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants