Do not count attribute overwrites as dropped attributes in AttributesMap - #8833
Merged
jack-berg merged 1 commit intoSep 24, 2026
Conversation
thswlsqls
marked this pull request as ready for review
September 18, 2026 01:09
Pull request dashboard statusMerged · refreshed 2026-09-24 20:22 UTC Status above doesn't look right?
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8833 +/- ##
============================================
+ Coverage 91.34% 91.38% +0.03%
- Complexity 10652 10657 +5
============================================
Files 1010 1010
Lines 28696 28697 +1
Branches 3682 3683 +1
============================================
+ Hits 26212 26224 +12
+ Misses 1683 1671 -12
- Partials 801 802 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jack-berg
approved these changes
Sep 24, 2026
Contributor
|
Thank you for your contribution @thswlsqls! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
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 #8832
Description
AttributesMap.put()incrementedtotalAddedValueseven when overwriting an existing key.getTotalAttributeCount()exposes that counter and the OTLP marshalers emittotal - sizeasdropped_attributes_count, so setting the same key twice produceddropped_attributes_count=1below the limit.0means nothing dropped), and opentelemetry-go/opentelemetry-python, which do not count overwrites as drops. Log records andrecordExceptionevents share the class and are corrected too.SdkSpanBuilderTest.setAllAttributes_mergesAttributesexpectation 8 -> 6: three builder attributes plus five merged (two overlapping names) are six unique names below the limit; the old 8 counted the two overwrites as drops (Add Span#setAttributes method to add Attributes to a Span #2799 did not discuss the number).Testing done
AttributesMapTest#put_overwriteDoesNotIncrementTotalAddedValuesand agetTotalAddedValues()assertion inputSameKeyDifferentType_doesNotConsumeExtraCapacity; both fail without the fix.SdkSpanTest#overwritingAttribute_doesNotCountAsDropped../gradlew :sdk:common:check :sdk:trace:checkpass;:sdk:logs:testand:exporters:otlp:common:testpass. No apidiff change (internal package).