-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java Logger API does not compliant with the OTel Logs Data Model #6626
Comments
Yes, please see #6591 |
Just some additional context, any value log bodies are available via Lines 85 to 135 in 5be177d
|
Closing as duplicate of #6591. |
Thanks! I'm wondering when exporting AnyValue log record body in OTLP format, will the structure of the log record body be preserved in OTLP's LogRecord::body field? https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/logs/v1/logs.proto#L167-L170 |
Yup. Check out this integration test which verifies this: Lines 654 to 794 in 5be177d
|
Maybe this is related to #6581.
In the OTel Logs Data Model, it is specified that the Body field must support any type to preserve the semantics of structured logs emitted by the application: https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-body. This is specifically useful for the application which logs a JSON-structured data i.e. map<string, any> as the Body. But the OTel Java LogRecordBuilder API does not support such a case, it only supports setting a String in the body: https://github.com/open-telemetry/opentelemetry-java/blob/main/api/all/src/main/java/io/opentelemetry/api/logs/LogRecordBuilder.java#L69-L70.
Ideally, if the LogRecordBuilder API preserves the semantics of structured data, the structure should be preserved across the stack (e.g. from application to OTel collector via OTLP and eventually the structured data gets exported to the backend log store).
Seems like there is also an Event API for logging structured data. But it is still a WIP and is a specialized Log API and would have the same issue in opentelemetry-java since the current API does not support structured data.
Also it seems like OTLP is able to carry structured data in LogRecord.body.
I filed a similar issue with OTel-Cpp at: open-telemetry/opentelemetry-cpp#3000.
The text was updated successfully, but these errors were encountered: