Repository navigation
Conversation
Implements prototype for Context-scoped attributes per OTEP open-telemetry#4931 and Issue open-telemetry#8532: - Add ContextAttributes API in :api:incubator for setting/getting/extracting attributes on Context - Support opt-in context-scoped attributes configuration across SdkTracerProvider, SdkLoggerProvider, and SdkMeterProvider - Inherit context attributes in SdkSpanBuilder, SdkLogRecordBuilder, and synchronous metric storage (Delta & Cumulative) - Expose configuration via declarative-config (tracer_provider, logger_provider, meter_provider) - Add comprehensive unit, incubating, and multi-signal integration tests
Pull request dashboard statusWaiting on reviewers · refreshed 2026-10-14 22:22 UTC Review the latest changes. Status above doesn't look right?
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8947 +/- ##
============================================
+ Coverage 90.65% 90.67% +0.01%
- Complexity 10887 10939 +52
============================================
Files 1015 1017 +2
Lines 29731 29894 +163
Branches 3876 3904 +28
============================================
+ Hits 26953 27106 +153
+ Misses 1860 1859 -1
- Partials 918 929 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rooks-ns
force-pushed
the
feat/context-scoped-attributes
branch
from
October 13, 2026 22:24
403a57c to
7d8f465
Compare
rooks-ns
marked this pull request as ready for review
October 14, 2026 18:25
rooks-ns
force-pushed
the
feat/context-scoped-attributes
branch
2 times, most recently
from
October 14, 2026 20:03
810c7b0 to
3b2ce44
Compare
rooks-ns
force-pushed
the
feat/context-scoped-attributes
branch
from
October 14, 2026 21:45
3b2ce44 to
e7872d7
Compare
This branch has not been deployed
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.
Overview
Implements a prototype of Context-scoped attributes as defined in OTEP #4931 and Issue #8532.
Context-scoped attributes attach OpenTelemetry
Attributesdirectly to in-processContext(viaThreadLocal), allowing Traces, Logs, and synchronous Metrics to automatically inherit them .Changes
api:incubator):ContextAttributes.add(Context, Attributes): Stores non-propagating attributes inContext(null/empty safe).ContextAttributes.get(Context): Pipeline/SDK reader; applications treat context attributes as write-only.sdk:trace):Sampler.shouldSample, enabling attribute-based sampling decisions.setNoParent()preserves ambient context attributes while decoupling the parent span (parentContext = Context.root()).sdk:logs):emit()into a separate record-level map to prevent attribute leakage across reusedLogRecordBuildercalls.sdk:metrics):BoundLongCounter,BoundDoubleCounter).canUseRootContextbypass when active to ensure thread-local context lookup.Sdk*ProviderUtil.setContextScopedAttributesEnabledand declaratively via the experimentalcontext_scoped_attributes/developmentflag.Verification
ContextScopedAttributesSpanTest,ContextScopedAttributesLogTest,ContextScopedAttributesMetricTest) verifying key collision precedence, limits, builder reuse isolation, bound instruments, andsetNoParent().ContextScopedAttributesIntegrationTest).