Skip to content

Stabilize Attribute and Attribute Collection representation for non-OTLP - #5149

Merged
pellared merged 11 commits into
open-telemetry:mainfrom
pellared:stab-non-otlp
Sep 18, 2026
Merged

pellared merged 11 commits into
open-telemetry:mainfrom
pellared:stab-non-otlp

Conversation

@pellared

@pellared pellared commented Jun 10, 2026 •

Copy link
Copy Markdown
Member

This is needed to unblock:

Prototypes:

I think that this sections are not controversial and could be stabilized without having more prototypes.

Please double-check the sections that are being stabilized in this PR.

@pellared

Copy link
Copy Markdown
Member Author

This should be part of v1.59.0 (and not upcoming v1.58.0). Therefore, I am adding a [DO NOT MERGE] prefix. Can block it with "Request changes" to avoid an accidental merge?

@pellared pellared changed the title Stabilize Attribute and Attribute Collection representation for non-OTLP [DO NOT MERGE] Stabilize Attribute and Attribute Collection representation for non-OTLP Jun 10, 2026
@pellared
pellared marked this pull request as ready for review June 10, 2026 16:26
@pellared
pellared requested a review from a team as a code owner June 10, 2026 16:26
@pellared

Copy link
Copy Markdown
Member Author

SIG meeting notes:
It would be nice to have prototypes for other languages than Go.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

This PR was marked stale. It will be closed in 14 days without additional activity.

@github-actions github-actions Bot added the Stale label Jul 2, 2026
@pellared pellared removed the Stale label Jul 2, 2026
@github-actions

Copy link
Copy Markdown

This PR was marked stale. It will be closed in 14 days without additional activity.

@github-actions github-actions Bot added the Stale label Jul 17, 2026
@pellared pellared removed the Stale label Jul 17, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-09-18 06:19 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@pellared pellared changed the title [DO NOT MERGE] Stabilize Attribute and Attribute Collection representation for non-OTLP Stabilize Attribute and Attribute Collection representation for non-OTLP Sep 2, 2026
@pellared

pellared commented Sep 2, 2026 •

Copy link
Copy Markdown
Member Author

I added a Java prototype. I think this should ready for review.
CC @open-telemetry/java-maintainers @open-telemetry/specs-approvers

@jack-berg jack-berg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have no issues with stabilizing this because I think its perfectly reasonable guidance for non-OTLP protocols, but I don't think we would want to move forward with the java implementation that changes our debugging logging representation away from the java idiomatic form to JSON. See my comment here: https://github.com/open-telemetry/opentelemetry-java/pull/8768/changes#r3973166559

@reyang

reyang commented Sep 15, 2026

Copy link
Copy Markdown
Member

We'll merge this PR by the end of Sep. 18th, 2026 unless there is blocking concerns.

@opentelemetry-pr-dashboard

This comment has been minimized.

@pellared
pellared added this pull request to the merge queue Sep 18, 2026
Merged via the queue into open-telemetry:main with commit a7125df Sep 18, 2026
11 checks passed
@pellared
pellared deleted the stab-non-otlp branch September 18, 2026 06:17
pellared added a commit to open-telemetry/opentelemetry-go that referenced this pull request Sep 21, 2026
Fixes #8146

Towards #7810

Adds `attribute.KeyValue.String`, using the stable [OpenTelemetry
Attribute representation for non-OTLP
protocols](https://opentelemetry.io/docs/specs/otel/common/#attribute-representation-for-non-otlp).
Each key-value pair is encoded as a single-member JSON object, and the
value reuses the existing non-OTLP AnyValue formatter so strings, byte
slices, special floating-point values, empty values, slices, and maps
are represented consistently with `attribute.Value.String`.

The governing representation was stabilized by
[open-telemetry/opentelemetry-specification#5149](open-telemetry/opentelemetry-specification#5149).

The implementation delegates to the shared map formatter used by
composite attribute values, keeping representation and escaping rules in
one place.

## Benchmarks

The direct `formatMap` call was compared with
`formatMapValue([1]KeyValue{kv})` over six runs. It reduced scalar
geomean latency by 35.84%, bytes by 57.14%, and allocations from two to
one while retaining the shared formatter.

Scalar values:

```console
$ go test -run '^$' -bench 'Benchmark(Bool|Int|Int64|Float64|String|ByteSlice)/KeyValueString$' -benchmem -count=1 ./attribute
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: AMD EPYC 7571
BenchmarkBool/KeyValueString-16             10230636    114.4 ns/op     48 B/op    1 allocs/op
BenchmarkInt/KeyValueString-16               9173830    128.7 ns/op     48 B/op    1 allocs/op
BenchmarkInt64/KeyValueString-16             8910942    131.9 ns/op     48 B/op    1 allocs/op
BenchmarkFloat64/KeyValueString-16           5223004    228.3 ns/op     48 B/op    1 allocs/op
BenchmarkString/KeyValueString-16            8326384    142.8 ns/op     48 B/op    1 allocs/op
BenchmarkByteSlice/KeyValueString-16         6661430    178.3 ns/op     48 B/op    1 allocs/op
```

Slice, composite, and map values:

```console
$ go test -run '^$' -bench 'Benchmark(BoolSlice|IntSlice|Int64Slice|Float64Slice|StringSlice|Slice|Map)/.*/KeyValueString$' -benchmem -count=1 ./attribute
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: AMD EPYC 7571
BenchmarkBoolSlice/Len2/KeyValueString-16          7323930    159.9 ns/op     48 B/op    1 allocs/op
BenchmarkBoolSlice/Len8/KeyValueString-16          2761668    436.5 ns/op    208 B/op    2 allocs/op
BenchmarkIntSlice/Len2/KeyValueString-16           3621410    330.8 ns/op    192 B/op    2 allocs/op
BenchmarkIntSlice/Len8/KeyValueString-16           1857816    646.6 ns/op    336 B/op    2 allocs/op
BenchmarkInt64Slice/Len2/KeyValueString-16         5898504    201.9 ns/op     64 B/op    1 allocs/op
BenchmarkInt64Slice/Len8/KeyValueString-16         1785464    670.7 ns/op    384 B/op    2 allocs/op
BenchmarkFloat64Slice/Len2/KeyValueString-16       2145739    557.6 ns/op    256 B/op    2 allocs/op
BenchmarkFloat64Slice/Len8/KeyValueString-16        829886     1315 ns/op    416 B/op    2 allocs/op
BenchmarkStringSlice/Len2/KeyValueString-16        4942752    241.9 ns/op     64 B/op    1 allocs/op
BenchmarkStringSlice/Len8/KeyValueString-16        1290357    929.6 ns/op    288 B/op    2 allocs/op
BenchmarkSlice/Len3/KeyValueString-16              5399734    221.3 ns/op     48 B/op    1 allocs/op
BenchmarkSlice/Len5Nested/KeyValueString-16        2104201    573.2 ns/op    208 B/op    2 allocs/op
BenchmarkMap/Len3/KeyValueString-16                2254777    533.8 ns/op    272 B/op    2 allocs/op
BenchmarkMap/Len5Nested/KeyValueString-16          1000000     1018 ns/op    368 B/op    2 allocs/op
```
@carlosalberto carlosalberto mentioned this pull request Oct 20, 2026
lizthegrey pushed a commit to honeycombio/opentelemetry-specification that referenced this pull request Oct 23, 2026
### Traces

- Add `Sampler.Shutdown` operation.

([open-telemetry#5335](open-telemetry#5335))
- Clarify that calls to the Development `SpanProcessor.OnEnding` method
are not
  allowed after `Shutdown`.

([open-telemetry#5316](open-telemetry#5316))

### Metrics

- Specify that `Shutdown` of the periodic exporting MetricReader MUST
include
  the effects of `ForceFlush`.

([open-telemetry#5305](open-telemetry#5305))

### Logs

- Add systemd-journald example mapping to the logs data model appendix
and align syslog mapping.

([open-telemetry#4995](open-telemetry#4995))

### Resource

- Update resource detectors to generate entities and indicate resource
detectors should be entity-aware
  unless new `OTEL_EXPERIMENTAL_ENTITIES_ENABLED != true`.

([open-telemetry#5147](open-telemetry#5147))

### Entities

- Add in-development entity-resource startup specification.

([open-telemetry#5057](open-telemetry#5057))
- Remove `OTEL_ENTITIES` from general env var configuration spec.

([open-telemetry#5147](open-telemetry#5147))

### Common

- Stabilize Attribute and Attribute Collection representation for
non-OTLP.

([open-telemetry#5149](open-telemetry#5149))
  
### OpenTelemetry Protocol

- Clarify that the OTLP exporter timeout bounds the entire batch export,
including all request attempts and waits between retries, and that
earlier
  caller deadlines take precedence.

([open-telemetry#5347](open-telemetry#5347))

### Compatibility

- Stabilize Prometheus Unknown-typed metric transformation.

([open-telemetry#5213](open-telemetry#5213))
- Stabilize Prometheus Info metric transformation.

([open-telemetry#5211](open-telemetry#5211))

### SDK Configuration

- Declarative config should gracefully degrade when encountering
unrecognized
resource detectors. Other SDK plugin components continue to produce
errors
  when missing.

([open-telemetry#5323](open-telemetry#5323))

### Supplementary Guidelines

- Allow narrowly scoped security-related changes to stable SDK and
Contrib
behavior, configuration defaults, supported values, and emitted
telemetry
without a major version bump, while preserving API compatibility and
requiring
release notes describing the security rationale, user impact, and
migration.

([open-telemetry#5357](open-telemetry#5357))

### OTEPs

- Add OTEP proposing a top-level span type field in API, SDK, and OTLP.

([open-telemetry#5233](open-telemetry#5233))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants