Skip to content
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

Logs data model canonical OTLP encoding for null any values #4392

Open
aabmass opened this issue Jan 30, 2025 · 1 comment
Open

Logs data model canonical OTLP encoding for null any values #4392

aabmass opened this issue Jan 30, 2025 · 1 comment
Labels
spec:logs Related to the specification/logs directory

Comments

@aabmass
Copy link
Member

aabmass commented Jan 30, 2025

What are you trying to achieve?

Updating the Python OTLP exporter to support None values nested within the Logs SDK any value open-telemetry/opentelemetry-python#4400. It is unclear how to convert null values into OTLP protobuf AnyValue messages. I may have missed it in the spec already but there are some unclear cases:

  1. KeyValue with null value: {"foo": None}. Should KeyValue.value be left unset or get an empty AnyValue?

  2. ArrayValue containing null: {"foo": [1, 2, None]}. The common spec is pretty clear that exporters should preserve the ordering:

    If exporters do not support exporting null values, they MAY replace those values by 0, false, or empty strings. This is required for map/dictionary structures represented as two arrays with indices that are kept in sync

    I think the empty AnyValue would be appropriate here.

  3. Body is null. Should LogRecord.body be left unset or be set to an explicit empty AnyValue?

For languages with undefined vs null distinction, this all gets more complicated so we should consider OTel JS too.

Additional context.

Note that 2 affects tracing and metrics as well since "null values within arrays MUST be preserved as-is (i.e., passed on to span processors / exporters as null)".

@aabmass aabmass added the spec:logs Related to the specification/logs directory label Jan 30, 2025
@trask trask added this to Logs SIG Jan 31, 2025
@aabmass
Copy link
Member Author

aabmass commented Jan 31, 2025

Protobuf's standard Struct message uses a separate oneof variant for NullValue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:logs Related to the specification/logs directory
Projects
Status: No status
Development

No branches or pull requests

1 participant