Skip to content

Add empty value attribute #4595

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

pellared
Copy link
Member

@pellared pellared commented Jul 17, 2025

Related OTEP: https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/4485-extending-attributes-to-support-complex-values.md

To be precise:

- **Complex attributes** include all other values supported by the `AnyValue` proto,
such as null (empty) value, maps, heterogeneous arrays, and combinations of those with primitives.
Byte arrays are also considered complex attributes, as they are excluded from
the current definition of *standard* attributes.
- **AnyValue** represents the type of *any* (simple or complex) attribute value on
the API, SDK, and [proto level](https://github.com/open-telemetry/opentelemetry-proto/blob/42319f8b5bf330f7c3dd4a097384f9f6d5467450/opentelemetry/proto/common/v1/common.proto#L28-L40).
It's also known as `any` in the [Log data model](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/data-model.md#type-any)

This is necessary to be able to represent an empty (that is the default) Log Record Body using "Standard Attributes".

This is needed towards stabilization of OTel Go Logs API and SDK (we need it "stable" though; not only "development"); more:

It is also worth mentioning that it is already allowed by OTLP:

message AnyValue {
  // The value is one of the listed fields. It is valid for all values to be unspecified
  // in which case this AnyValue is considered to be "empty".
  oneof value {

Prototype:

Also fixes #4468

as it removes the portion which said that extending the attribute types is a breaking change as it was already approved via #4485.

@pellared pellared self-assigned this Jul 17, 2025
@pellared pellared moved this from Todo to In Progress in Go: Logs (GA) Jul 17, 2025
@pellared pellared moved this to In progress in Logs SIG Jul 17, 2025
@pellared pellared added the maintainer-request Escalated by SIG maintainers label Jul 17, 2025
@pellared
Copy link
Member Author

CC @open-telemetry/go-maintainers

@pellared pellared marked this pull request as ready for review July 17, 2025 21:49
@pellared pellared requested review from a team as code owners July 17, 2025 21:49
@pellared pellared changed the title Add empty value to attribute Add empty value attribute Jul 17, 2025
@@ -83,21 +81,6 @@ reflects that LogRecord attributes are expected to model data produced from
external log APIs, which do not necessarily have the same value type
restrictions as the standard attribute definition.

Note: Extending the set of standard attribute value types is a breaking change.
Copy link
Contributor

@lmolkova lmolkova Jul 18, 2025

Choose a reason for hiding this comment

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

I think we need to start with proto changes and replace comments like https://github.com/open-telemetry/opentelemetry-proto/blob/be5d58470429d0255ffdd49491f0815a3a63d6ef/opentelemetry/proto/trace/v1/trace.proto#L209-L213

// The OpenTelemetry API specification further restricts the allowed value types:
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute
// Attribute keys MUST be unique (it is not allowed to have more than one
// attribute with the same key).

(as per https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/4485-extending-attributes-to-support-complex-values.md#proto)

we probably need to replace it with comment that they are going to be allowed in 6 months

- Stable exporters will be prohibited from emitting complex attributes by default on signals
other than Logs until at least 6 months after this OTEP is merged.


Or, at least, leave a note here that complex attributes are coming and their support is in development, nobody should stabilize them in the next 6 month.

Copy link
Member Author

@pellared pellared Jul 18, 2025

Choose a reason for hiding this comment

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

we probably need to replace it with comment that they are going to be allowed in 6 months

I feel like this is an orthogonal PR given the changes of https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute are marked with Development status.

Therefore, I think a PR in proto repo can be done in parallel. Are you able to help with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer-request Escalated by SIG maintainers
Projects
Status: In Progress
Status: In progress
Development

Successfully merging this pull request may close these issues.

Review the language around standard attributes (and breaking changes)
3 participants