Repository navigation
log: use attribute values for records - #8490
Merged
Merged
Conversation
Codecov Reportโ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8490 +/- ##
=======================================
- Coverage 84.1% 83.9% -0.3%
=======================================
Files 325 323 -2
Lines 26194 25739 -455
=======================================
- Hits 22041 21605 -436
+ Misses 3771 3756 -15
+ Partials 382 378 -4
๐ New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request aligns the Logs API and SDK with the shared go.opentelemetry.io/otel/attribute value model by removing log-specific structured value types and using attribute.Value / attribute.KeyValue for log bodies and attributes across the API, SDK, test helpers, and OTLP/stdout exporters.
Changes:
- Replace log-specific
Kind/Value/KeyValuewithattribute.Value/attribute.KeyValuethroughout log API, SDK, logtest helpers, and exporters. - Refactor
attrdeduphelpers (SDK + templates) to return(value, changed)and update call sites accordingly. - Update docs, examples, and changelog entries to reflect the new attribute-backed logging model.
Reviewed changes
Copilot reviewed 50 out of 57 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/trace/span.go | Adapt attrdedup call signature |
| sdk/trace/provider.go | Adapt attrdedup.Set signature |
| sdk/resource/resource.go | Adapt attrdedup.KeyValues signature |
| sdk/metric/provider.go | Adapt attrdedup.Set signature |
| sdk/metric/internal/attrdedup/dedup.go | Return โchangedโ from helpers |
| sdk/metric/internal/attrdedup/dedup_test.go | Test โchangedโ results |
| sdk/metric/instrument.go | Adapt attrdedup signatures |
| sdk/log/ring_test.go | Use attribute.Value body type |
| sdk/log/record.go | Use attribute.Value/KeyValue + normalization |
| sdk/log/provider.go | Adapt attrdedup.Set signature |
| sdk/log/logtest/factory.go | Factory uses attribute types |
| sdk/log/logtest/factory_test.go | Update tests to attribute types |
| sdk/log/logtest/example_test.go | Update example to attribute.Value |
| sdk/log/logger.go | Switch exception attrs to attribute.Key |
| sdk/log/logger_test.go | Update tests to attribute values |
| sdk/log/logger_bench_test.go | Update benches to attribute values |
| sdk/log/internal/attrdedup/dedup.go | Return โchangedโ from helpers |
| sdk/log/internal/attrdedup/dedup_test.go | Test โchangedโ results |
| sdk/log/exporter_test.go | Update record bodies to attribute.Value |
| sdk/log/example_test.go | Update processors to attribute types |
| sdk/log/DESIGN.md | Document attribute-backed SDK record model |
| sdk/log/bench_test.go | Update benchmarks to attribute types |
| sdk/log/batch_test.go | Update tests/bench to attribute.Value |
| sdk/internal/attrdedup/dedup.go | Return โchangedโ from helpers |
| sdk/internal/attrdedup/dedup_test.go | Test โchangedโ results |
| sdk/internal/attrdedup/dedup_benchmark_test.go | Adapt benchmark call signature |
| log/record.go | API record uses attribute.Value/KeyValue |
| log/record_test.go | Update tests to attribute types |
| log/record_bench_test.go | Update benches to attribute types |
| log/logtest/recorder.go | Recorder stores attribute types |
| log/logtest/recorder_test.go | Update tests to attribute types |
| log/logtest/go.sum | Module dependency updates |
| log/logtest/go.mod | Module dependency updates |
| log/logtest/example_test.go | Update example to attribute types |
| log/logtest/assert.go | Compare attribute.Value in assertions |
| log/logtest/assert_test.go | Update assertion tests to attribute types |
| log/kind_string.go | Removed (obsolete log.Kind) |
| log/keyvalue.go | Removed (obsolete log.Value/KeyValue) |
| log/keyvalue_test.go | Removed (obsolete log.Value/KeyValue tests) |
| log/keyvalue_bench_test.go | Removed (obsolete log.Value/KeyValue benches) |
| log/DESIGN.md | Update design doc to attribute types |
| internal/shared/otlp/otlplog/transform/log.go.tmpl | Use Attr/AttrValue for logs |
| internal/shared/otlp/otlplog/transform/log_test.go.tmpl | Update templates to attribute types |
| internal/shared/otlp/otlplog/transform/log_attr_test.go.tmpl | Update attr tests to attribute types |
| internal/shared/attrdedup/dedup.go.tmpl | Template: return โchangedโ |
| internal/shared/attrdedup/dedup_test.go.tmpl | Template tests for โchangedโ |
| exporters/stdout/stdoutlog/record.go | Marshal attribute.Value directly |
| exporters/stdout/stdoutlog/exporter_test.go | Update stdoutlog tests for attribute |
| exporters/otlp/otlplog/otlploghttp/internal/transform/log.go | Use Attr/AttrValue for logs |
| exporters/otlp/otlplog/otlploghttp/internal/transform/log_test.go | Update tests to attribute types |
| exporters/otlp/otlplog/otlploghttp/internal/transform/log_attr_test.go | Update attr tests to attribute types |
| exporters/otlp/otlplog/otlploggrpc/internal/transform/log.go | Use Attr/AttrValue for logs |
| exporters/otlp/otlplog/otlploggrpc/internal/transform/log_test.go | Update tests to attribute types |
| exporters/otlp/otlplog/otlploggrpc/internal/transform/log_attr_test.go | Update attr tests to attribute types |
| exporters/otlp/otlplog/otlploggrpc/exporter_test.go | Update exporter tests to attribute |
| CHANGELOG.md | Document breaking removals/changes |
Files not reviewed (6)
- exporters/otlp/otlplog/otlploggrpc/internal/transform/log.go: Generated file
- exporters/otlp/otlplog/otlploggrpc/internal/transform/log_attr_test.go: Generated file
- exporters/otlp/otlplog/otlploggrpc/internal/transform/log_test.go: Generated file
- exporters/otlp/otlplog/otlploghttp/internal/transform/log.go: Generated file
- exporters/otlp/otlplog/otlploghttp/internal/transform/log_attr_test.go: Generated file
- exporters/otlp/otlplog/otlploghttp/internal/transform/log_test.go: Generated file
pellared
marked this pull request as ready for review
June 19, 2026 12:06
pellared
requested review from
MrAlias,
XSAM,
dashpole,
dmathieu and
flc1125
as code owners
June 19, 2026 12:06
pellared
commented
Jun 19, 2026
pellared
marked this pull request as draft
June 19, 2026 12:38
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 57 changed files in this pull request and generated 1 comment.
Files not reviewed (6)
- exporters/otlp/otlplog/otlploggrpc/internal/transform/log.go: Generated file
- exporters/otlp/otlplog/otlploggrpc/internal/transform/log_attr_test.go: Generated file
- exporters/otlp/otlplog/otlploggrpc/internal/transform/log_test.go: Generated file
- exporters/otlp/otlplog/otlploghttp/internal/transform/log.go: Generated file
- exporters/otlp/otlplog/otlploghttp/internal/transform/log_attr_test.go: Generated file
- exporters/otlp/otlplog/otlploghttp/internal/transform/log_test.go: Generated file
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 task
teemow
added a commit
to teemow/kagent
that referenced
this pull request
Sep 16, 2026
ADK v2.3.0 ships native context compaction (session/compaction: sliding window, tail retention, LLM summarizer) and the runner hook that applies it. The OpenTelemetry exporters and contrib instrumentation move to the matching v1.45.0 / v0.21.0 / v0.70.0 set, which the new ADK version already requires for otel/log. otel/log v0.21.0 hands log bodies and attributes as attribute.Value and attribute.KeyValue and drops its own Value type (open-telemetry/opentelemetry-go#8490); the telemetry test builds its record body with attribute.StringValue accordingly. Signed-off-by: Timo Derstappen <teemow@gmail.com>
teemow
added a commit
to teemow/kagent
that referenced
this pull request
Sep 16, 2026
ADK v2.3.0 ships native context compaction (session/compaction: sliding window, tail retention, LLM summarizer) and the runner hook that applies it. The OpenTelemetry exporters and contrib instrumentation move to the matching v1.45.0 / v0.21.0 / v0.70.0 set, which the new ADK version already requires for otel/log. otel/log v0.21.0 hands log bodies and attributes as attribute.Value and attribute.KeyValue and drops its own Value type (open-telemetry/opentelemetry-go#8490); the telemetry test builds its record body with attribute.StringValue accordingly. Signed-off-by: Timo Derstappen <teemow@gmail.com>
teemow
added a commit
to teemow/kagent
that referenced
this pull request
Sep 16, 2026
ADK v2.3.0 ships native context compaction (session/compaction: sliding window, tail retention, LLM summarizer) and the runner hook that applies it. The OpenTelemetry exporters and contrib instrumentation move to the matching v1.45.0 / v0.21.0 / v0.70.0 set, which the new ADK version already requires for otel/log. otel/log v0.21.0 hands log bodies and attributes as attribute.Value and attribute.KeyValue and drops its own Value type (open-telemetry/opentelemetry-go#8490); the telemetry test builds its record body with attribute.StringValue accordingly. Signed-off-by: Timo Derstappen <teemow@gmail.com>
nisargabd
added a commit
to OpenAgriNet/network-adapter
that referenced
this pull request
Sep 18, 2026
CVE-2026-81871 (otlploggrpc v0.19.0, MEDIUM) and CVE-2026-81870 (otlptrace, otlptracegrpc, otel/sdk, LOW) were failing trivy-gate on every PR. Bumps the whole otel release train together -- v1.45.0 for the stable line, v0.21.0 for the log line -- rather than only the four flagged modules, because the two lines are released in lockstep. otel/log v0.21.0 drops its own Value/KeyValue types in favour of the shared go.opentelemetry.io/otel/attribute ones (upstream open-telemetry/opentelemetry-go#8490), so the audit-log call sites move to attribute.String/StringValue/KeyValue. Same keys, same values, same OTLP output -- no behaviour change. A narrower bump is not possible: otlploggrpc v0.21.0 requires otel/log v0.21.0, so module resolution pulls the new API in regardless. stdHandler.go also picks up a gofmt pass: it was already unformatted on development, and the pre-commit hook checks any file the commit touches. Whitespace only, no logic in those lines.
teemow
added a commit
to teemow/kagent
that referenced
this pull request
Sep 20, 2026
ADK v2.3.0 ships native context compaction (session/compaction: sliding window, tail retention, LLM summarizer) and the runner hook that applies it. The OpenTelemetry exporters and contrib instrumentation move to the matching v1.45.0 / v0.21.0 / v0.70.0 set, which the new ADK version already requires for otel/log. otel/log v0.21.0 hands log bodies and attributes as attribute.Value and attribute.KeyValue and drops its own Value type (open-telemetry/opentelemetry-go#8490); the telemetry test builds its record body with attribute.StringValue accordingly. Signed-off-by: Timo Derstappen <teemow@gmail.com>
AmyDe
added a commit
to AmyDe/town-crier
that referenced
this pull request
Sep 20, 2026
โฆ-1hn5n) otel/log v0.21.0 removed log.Value, log.KeyValue and their constructors (open-telemetry/opentelemetry-go#8490), so the pinned otelslog bridge v0.19.0 no longer compiles against it. otelslog v0.20.0 is the release built for otel/log v0.21.0 and otel v1.45.0, which is exactly the set this Dependabot bump moves to. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0118hH166dW23tXjqiu2Kb8v
rita7lopes
added a commit
to metrico/otel-collector
that referenced
this pull request
Sep 22, 2026
otel/log v0.21.0 removes Kind, Value and KeyValue in favour of attribute.Value (open-telemetry/opentelemetry-go#8490), so every module that consumes that API has to move in the same commit. Bumping otlploggrpc on its own (#172) pulled otel/log to v0.21.0 through MVS while leaving otlploghttp, stdoutlog and the otelzap bridge on the removed API, which broke the build of cmd/otel-collector. Moved as one set: otel/log v0.20.0 -> v0.21.0 otel/sdk/log v0.20.0 -> v0.21.0 otlplog/otlploggrpc v0.20.0 -> v0.21.0 otlplog/otlploghttp v0.20.0 -> v0.21.0 stdout/stdoutlog v0.20.0 -> v0.21.0 contrib/bridges/otelzap v0.19.0 -> v0.20.0 otelzap v0.20.0 is the release that requires otel/log v0.21.0; v0.19.0 caps at v0.20.0 and v0.20.1 already requires v0.22.0. Staying on the v0.21.0 set keeps the otel core at v1.45.0, so this change touches the log family only.
rorua
added a commit
to alifcapital/otelemetry
that referenced
this pull request
Sep 23, 2026
โฆable deps Upgrade OpenTelemetry to v1.46.0 (logs v0.22.0) and pick up security fixes in grpc v1.84.0, x/crypto v0.57.0, x/net v0.59.0, x/text v0.42.0 and klauspost/compress v1.20.0. otel/log v0.21.0 removed log.KeyValue/log.Value in favor of attribute.KeyValue/attribute.Value (open-telemetry/opentelemetry-go#8490), so the Log interface and LogAttribute now use attribute.KeyValue. BREAKING CHANGE: Log.Debug/Info/Warning/Error/Fatal take ...attribute.KeyValue and LogAttribute returns attribute.KeyValue. See MIGRATION.md.
rorua
added a commit
to alifcapital/otelemetry
that referenced
this pull request
Sep 23, 2026
โฆable deps (#4) Upgrade OpenTelemetry to v1.46.0 (logs v0.22.0) and pick up security fixes in grpc v1.84.0, x/crypto v0.57.0, x/net v0.59.0, x/text v0.42.0 and klauspost/compress v1.20.0. otel/log v0.21.0 removed log.KeyValue/log.Value in favor of attribute.KeyValue/attribute.Value (open-telemetry/opentelemetry-go#8490), so the Log interface and LogAttribute now use attribute.KeyValue. BREAKING CHANGE: Log.Debug/Info/Warning/Error/Fatal take ...attribute.KeyValue and LogAttribute returns attribute.KeyValue. See MIGRATION.md.
kelvinprabhu
pushed a commit
to OpenAgriNet/network-adapter
that referenced
this pull request
Sep 30, 2026
CVE-2026-81871 (otlploggrpc v0.19.0, MEDIUM) and CVE-2026-81870 (otlptrace, otlptracegrpc, otel/sdk, LOW) were failing trivy-gate on every PR. Bumps the whole otel release train together -- v1.45.0 for the stable line, v0.21.0 for the log line -- rather than only the four flagged modules, because the two lines are released in lockstep. otel/log v0.21.0 drops its own Value/KeyValue types in favour of the shared go.opentelemetry.io/otel/attribute ones (upstream open-telemetry/opentelemetry-go#8490), so the audit-log call sites move to attribute.String/StringValue/KeyValue. Same keys, same values, same OTLP output -- no behaviour change. A narrower bump is not possible: otlploggrpc v0.21.0 requires otel/log v0.21.0, so module resolution pulls the new API in regardless. stdHandler.go also picks up a gofmt pass: it was already unformatted on development, and the pre-commit hook checks any file the commit touches. Whitespace only, no logic in those lines.
frenchfrywpepper
added a commit
to redpanda-data/common-go
that referenced
this pull request
Oct 19, 2026
go.opentelemetry.io/otel/sdk/log below v0.21.0 is affected by CVE-2026-81872 (Allocation of Resources Without Limits or Throttling). Consumers such as cloudv2 cannot upgrade past it while this module pins otel/log v0.19.0, because v0.21.0 does not compile against the current log transform. otel v1.45.0 replaced log.Value/log.KeyValue with attribute.Value and attribute.KeyValue for log bodies and attributes (open-telemetry/opentelemetry-go#8490). Log attributes now go through attributeValueToProto, which gains the EMPTY, BYTESLICE, SLICE and MAP cases the log-specific converter used to handle. Spans, resources and metrics get the same encoding for those attribute types, which are new in otel v1.45.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
timothybrush
pushed a commit
to timothybrush/gastown
that referenced
this pull request
Oct 24, 2026
โฆ advisories Fixes open Dependabot alerts on go.mod: - google.golang.org/grpc 1.80.0 -> 1.83.2 (GHSA-hrxh-6v49-42gf, GHSA-vp52-pcj8-j9qc, GHSA-2v4p-qf9q-27wj, GHSA-qc2q-p7wx-3px3; 1.83.2 also clears GO-2026-6443) - github.com/apache/thrift 0.23.0 -> 0.24.0 (GHSA-8wv5-x4w7-5gww) - github.com/moby/go-archive 0.2.0 -> 0.3.0 (GHSA-hfg8-hc9c-6c3h) - go.opentelemetry.io/otel/sdk 1.43.0 -> 1.45.0 (GHSA-8wmf-6v46-5gfg) - go.opentelemetry.io/otel/sdk/log 0.19.0 -> 0.21.0 (GHSA-hjf4-fphr-2h65) The rest of the OTel family moves with it (1.45.0 / 0.21.0) so the modules stay in lockstep. golang.org/x/net goes to 0.60.0 to clear GO-2026-6603/6610/6611/6612/6617, which govulncheck reports as reachable from cmd/gt. otel/log 0.21.0 removed its own KeyValue/Value types in favor of go.opentelemetry.io/otel/attribute (open-telemetry/opentelemetry-go#8490), so internal/telemetry now builds log attributes with attribute.String, attribute.Int64 and friends. Behavior is unchanged. gofmt also realigns a var block in recorder.go that was already misformatted on main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
vito
pushed a commit
to dagger/otel-go
that referenced
this pull request
Nov 24, 2026
OpenTelemetry 1.45.0/0.21.0 replaced log.KeyValue and log.Value with attribute.KeyValue and attribute.Value for log bodies and attributes (open-telemetry/opentelemetry-go#8490), so the log packages and OTLP log exporters couldn't be upgraded past 0.19 without this change. Log values now go through the same OTLP converter as span attributes, which gains the byte slice, slice and map types attribute picked up for logs. Bumps otel to 1.45.0 and the log packages and OTLP log exporters to 0.21.0, which picks up the fixes for GO-2026-6508 (otlploggrpc) and GO-2026-6615 (sdk/log), plus grpc 1.83.1 and x/net 0.60.0. Signed-off-by: Franco Papalardo <francopapalardo93@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7034.
Kind,Value,KeyValue, value constructors, and attribute conversion helpers fromgo.opentelemetry.io/otel/log.attribute.Valueandattribute.KeyValuefor log bodies and attributes acrossgo.opentelemetry.io/otel/log,go.opentelemetry.io/otel/log/logtest,go.opentelemetry.io/otel/sdk/log, andgo.opentelemetry.io/otel/sdk/log/logtest.attribute.Valuedirectly.WithAllowKeyDuplication, nested-map deduplication, recursive attribute value truncation, and zero-body semantics.attrdeduphelpers to return whether normalization changed the input instead of adding parallel*Changedhelper functions.Benchmarks
Logs API benchmarks
Allocation counts were unchanged.
The large
Record/Bodypercentage is an artifact of comparing against a sub-nanosecond baseline: the benchmark increased from 0.4146 ns/op to 2.5160 ns/op, so the absolute change is about 2.1 ns/op. This path only stores and reads anattribute.BoolValue(true); it does not normalize, allocate, or walk nested values. The extra time comes from usingattribute.Valueas the record body. On amd64 it is wider than the removed log-specificValue, sovar r log.Record,SetBody, andBodymove/zero more bytes even for a simple boolean body. TheB/opandallocs/optables stay at zero for this benchmark.SDK log benchmarks use selected body and attribute normalization paths with a short benchmark window to keep the repeated comparison stable in this environment:
Normalization here means recursively applying the SDK's canonical log-record rules to attribute values before export: duplicate keys inside
attribute.MAPvalues are removed with last-value-wins semantics, nestedMAP/SLICEvalues are normalized the same way, and attribute value length limits are applied to string-like values inside attributes.The duplicate-key and nested-map SDK paths are slower because normalization now walks generic
attribute.ValueMAP/SLICEtrees and rebuilds changed subtrees withattribute.MapValue/attribute.SliceValue. The no-op andWithAllowKeyDuplicationpaths still avoid allocations, but duplicate or nested changes require new value/key-value slices.