[API] Avoid SpanAttributes array enumeration - #7698
Merged
martincostello merged 4 commits intoSep 8, 2026
Merged
martincostello merged 4 commits into
martincostello merged 4 commits into
Conversation
Contributor
|
Welcome, contributor! Thank you for your contribution to opentelemetry-dotnet. Important reminders:
|
Pull request dashboard statusMerged · refreshed 2026-09-08 10:14 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 #7698 +/- ##
==========================================
- Coverage 91.69% 91.68% -0.01%
==========================================
Files 333 333
Lines 18287 18290 +3
==========================================
+ Hits 16769 16770 +1
- Misses 1518 1520 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Member
|
Could you add/update some tests for the missing patch coverage please? |
This comment has been minimized.
This comment has been minimized.
Add coverage for `KeyValuePair<string, object?>[]` being passed to the constructor.
Contributor
Author
|
Woops sorry @martincostello I missed these notifications. Looks like you're on it? |
martincostello
approved these changes
Sep 8, 2026
martincostello
enabled auto-merge
September 8, 2026 09:43
Merged
via the queue into
open-telemetry:main
with commit Sep 8, 2026
4bb4720
150 of 152 checks passed
Contributor
|
Thank you for your contribution @thomhurst! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
This was referenced Sep 18, 2026
This was referenced Sep 25, 2026
Merged
Merged
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.
Changes
Use
ReadOnlySpan<T>enumeration when the existingSpanAttributesIEnumerable<T>constructor receives an array. Arbitrary enumerable inputsretain the existing path, and public API remains unchanged.
An
IReadOnlyList<T>indexed path was also tested. It had no allocation benefitfor
List<T>on .NET 10 and mixed timing results, so it is not included.Benchmark
A task-scoped BenchmarkDotNet benchmark constructed
SpanAttributesfrom apre-created array containing 1, 5, or 20 attributes. It was run before and after
this change using BenchmarkDotNet 0.15.8 on .NET 10.0.11, Windows 11, Intel Core
i7-12700K.
The array path removes 32 B per construction at every tested size.
Benchmark method:
arraywas initialized inGlobalSetup;[MemoryDiagnoser]was enabled andItemCountused[Params(1, 5, 20)].Merge requirement checklist
SpanAttributesTestspassCHANGELOG.mdfiles updated for non-trivial changes