sdk: consolidate attribute normalization in attrnorm - #8611
Merged
pellared merged 5 commits intoJul 23, 2026
Merged
Conversation
pellared
requested review from
MrAlias,
XSAM,
dashpole,
dmathieu and
flc1125
as code owners
July 15, 2026 06:52
pellared
marked this pull request as draft
July 15, 2026 10:52
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8611 +/- ##
=====================================
Coverage 84.0% 84.0%
=====================================
Files 326 328 +2
Lines 25942 25979 +37
=====================================
+ Hits 21799 21838 +39
+ Misses 3761 3760 -1
+ Partials 382 381 -1
🚀 New features to boost your workflow:
|
pellared
marked this pull request as ready for review
July 15, 2026 12:13
Member
Author
|
@ps-mir, PTAL |
ps-mir
approved these changes
Jul 16, 2026
ps-mir
left a comment
There was a problem hiding this comment.
I'm more satisfied with this change compared to initial plans. Despite the size of the PR, its a simplified refactoring, which moves truncation logic in shared internal template package and repurpose it as attrnorm.
Keeping truncation logic in a separate file is good.
There are no logical path changes apart from 1 small conditional logic as a result of unifying value truncation.
A nit on package comment, but nothing blocking. LGTM
MrAlias
approved these changes
Jul 23, 2026
dashpole
approved these changes
Jul 23, 2026
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 #8499
Motivation
attrdeduppackages used by Trace, Logs, and Metrics. This change establishes module-localinternal/attrnormpackages generated from shared templates.Changes
internal/shared/attrdeduptointernal/shared/attrnormwithout changing its behavior.attrnormtemplates.go.opentelemetry.io/otel/sdkandgo.opentelemetry.io/otel/sdk/log; generate deduplication only forgo.opentelemetry.io/otel/sdk/metric.attribute.KeyValue, while Logs truncates itsattribute.Valueand keeps body handling deduplication-only.internal/attrnormpackage, and remove all obsoleteattrdedupgeneration and consumers.TruncateValuecoverage for negative limits, scalar strings, truncated map values, and unchanged maps, while retaining module-level integration coverage.Benchmarks
Focused before/after benchmarks were collected with
-benchmemand 10 samples, then compared withbenchstat.AddAttributes: -7.8%hit, -4.2% not-hit;
SetAttributes: no significant change).