feat(api-logs)!: change scopeAttributes to be of type LogAttributes#6354
Open
AnubhavPurohit691 wants to merge 1 commit intoopen-telemetry:mainfrom
Open
Conversation
pichlermarc
reviewed
Jan 30, 2026
|
|
||
| ### :bug: Bug Fixes | ||
|
|
||
| * fix(api-logs): use LogAttributes for LoggerOptions#scopeAttributes [#????](https://github.com/open-telemetry/opentelemetry-js/pull/????) @author |
Member
There was a problem hiding this comment.
this is not a bugfix for sure, but a breaking change feature.
Member
There was a problem hiding this comment.
please move this up to breaking changes :)
pichlermarc
reviewed
Jan 30, 2026
Member
pichlermarc
left a comment
There was a problem hiding this comment.
This is pending a decision and the ticket is not yet ready to be worked on, see #6350.
Note that if we decide to do this, the PR also needs tests in sdk-logs.
LogAttributes
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6354 +/- ##
=======================================
Coverage 95.68% 95.68%
=======================================
Files 313 313
Lines 9667 9667
Branches 2226 2226
=======================================
Hits 9250 9250
Misses 417 417 🚀 New features to boost your workflow:
|
Member
|
@AnubhavPurohit691, we've decided to go ahead with this change - please address the comment and then this should be good to merge. |
3 tasks
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.
Which problem is this PR solving?
LoggerOptions#scopeAttributeswas typed asAttributes(from the trace API). Scope attributes are part of the logs API and should use the same value space as log attributes. UsingLogAttributes(AnyValueMap) is correct because:LogAttributes.LogAttributesallows nested objects,Uint8Array, null/undefined, etc.; traceAttributesonly allows primitives and arrays of primitives.This PR updates the type to
LogAttributesand adds tests plus a changelog entry.Fixes #6350
Short description of the changes
experimental/packages/api-logs/src/types/LoggerOptions.ts: ChangescopeAttributestype fromAttributestoLogAttributes; import from./LogRecordinstead of@opentelemetry/api.experimental/CHANGELOG.md: Add entry under Unreleased → Bug Fixes.noop-logger-provider.test.ts, add tests thatgetLoggeracceptsscopeAttributeswith primitive and full LogAttribute value types. Inproxy-logger.test.ts, add test that options (includingscopeAttributes) are passed through to the delegate.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
getLogger('logger-name', undefined, { scopeAttributes: { ... } })with (1) primitive values and (2) full LogAttribute value types (string, number, boolean, array, nested object, Uint8Array, null). Assert returned logger is a NoopLogger.getLogger('test', 'v0', { schemaUrl, scopeAttributes })withscopeAttributescontaining primitives, nested object, and Uint8Array. Assert delegategetLoggeris called with the same options andscopeAttributesis forwarded.Run:
cd experimental/packages/api-logs && npm test— all 18 tests pass, including the new scopeAttributes tests.Checklist: