Skip to content

feat(api-logs, sdk-logs)!: add Logger#enabled method#6371

Merged
david-luna merged 27 commits intoopen-telemetry:mainfrom
david-luna:add-logger-enabled
Mar 30, 2026
Merged

feat(api-logs, sdk-logs)!: add Logger#enabled method#6371
david-luna merged 27 commits intoopen-telemetry:mainfrom
david-luna:add-logger-enabled

Conversation

@david-luna
Copy link
Copy Markdown
Contributor

@david-luna david-luna commented Feb 4, 2026

Which problem is this PR solving?

Closes #6351

Added as a breaking change since anyone implementing this interface now must to implement the new method.

Short description of the changes

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit tests

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.73%. Comparing base (549a7f9) to head (2f93dd0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ages/sdk-logs/src/export/NoopLogRecordProcessor.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6371      +/-   ##
==========================================
+ Coverage   95.71%   95.73%   +0.01%     
==========================================
  Files         369      369              
  Lines       12461    12494      +33     
  Branches     2945     2956      +11     
==========================================
+ Hits        11927    11961      +34     
+ Misses        534      533       -1     
Files with missing lines Coverage Δ
experimental/packages/api-logs/src/NoopLogger.ts 100.00% <100.00%> (ø)
experimental/packages/api-logs/src/ProxyLogger.ts 89.47% <100.00%> (+1.23%) ⬆️
experimental/packages/sdk-logs/src/Logger.ts 100.00% <100.00%> (ø)
...l/packages/sdk-logs/src/MultiLogRecordProcessor.ts 100.00% <100.00%> (ø)
...ages/sdk-logs/src/export/NoopLogRecordProcessor.ts 75.00% <80.00%> (+8.33%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@david-luna david-luna changed the title feat(api-lods, sdk-logs): add Logger#enabled method feat(api-logs, sdk-logs): add Logger#enabled method Feb 5, 2026
@david-luna david-luna marked this pull request as ready for review February 5, 2026 09:25
@david-luna david-luna requested review from a team as code owners February 5, 2026 09:25
@david-luna david-luna added this to the Logs API/SDK GA milestone Feb 5, 2026
@david-luna david-luna changed the title feat(api-logs, sdk-logs): add Logger#enabled method feat(api-logs, sdk-logs)!: add Logger#enabled method Feb 5, 2026
Comment thread experimental/packages/api-logs/src/types/Logger.ts Outdated
Comment thread experimental/packages/sdk-logs/src/Logger.ts Outdated
Copy link
Copy Markdown
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for working on this 🙌
A few more comments around the SDK impl.

Comment thread experimental/CHANGELOG.md Outdated
Comment thread experimental/packages/sdk-logs/src/Logger.ts Outdated
Comment thread experimental/packages/sdk-logs/src/Logger.ts Outdated
@david-luna david-luna requested a review from a team as a code owner February 26, 2026 11:21
Comment thread experimental/packages/api-logs/src/NoopLogger.ts
Comment thread experimental/packages/sdk-logs/src/export/NoopLogRecordProcessor.ts
await Promise.all(this.processors.map(processor => processor.shutdown()));
}

public enabled(options: {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for reviewer: IMO it must be implemented here since any of the processors may implement it and need to be called if so

Copy link
Copy Markdown
Contributor

@trentm trentm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a start at reviewing. I spent way too much time reading specs and other implementations and poking around.

Comment thread experimental/packages/api-logs/src/NoopLogger.ts
Comment thread experimental/packages/api-logs/src/types/Logger.ts Outdated
Comment thread experimental/packages/api-logs/src/ProxyLogger.ts Outdated
Comment thread experimental/packages/sdk-logs/src/Logger.ts
Copy link
Copy Markdown
Contributor

@trentm trentm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next review. I haven't looked at tests yet.

Comment thread experimental/packages/sdk-logs/src/MultiLogRecordProcessor.ts Outdated
Comment thread experimental/packages/api-logs/src/types/Logger.ts Outdated
Comment thread experimental/packages/api-logs/src/ProxyLogger.ts Outdated
Comment thread experimental/packages/sdk-logs/src/export/NoopLogRecordProcessor.ts Outdated
Comment thread experimental/packages/sdk-logs/src/Logger.ts Outdated
Comment thread experimental/packages/sdk-logs/src/LogRecordProcessor.ts Outdated
Comment thread experimental/packages/sdk-logs/src/Logger.ts Outdated
Comment thread experimental/packages/sdk-logs/src/Logger.ts Outdated
Comment thread experimental/packages/sdk-logs/src/Logger.ts Outdated
Copy link
Copy Markdown
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thank you for tackling this 🙌

Comment thread experimental/CHANGELOG.md Outdated
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
@david-luna david-luna requested a review from trentm March 18, 2026 16:05
Copy link
Copy Markdown
Contributor

@trentm trentm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just the changelog nit. Thanks!

Comment thread experimental/CHANGELOG.md Outdated
`NodeSDK` from `@opentelemetry/sdk-node` to get automatic environment variable configuration.
* fix(instrumentation-http)!: do not normalize hyphens to underscores in captured header attribute names if using stable semconv [#6381](https://github.com/open-telemetry/opentelemetry-js/issues/6381) @trentm
* With the `headersToSpanAttributes` option, one can specify that HTTP headers should be captured as span attributes named `http.{request,response}.header.HEADERNAME`. With old Semantic Conventions, the `HEADERNAME` normalizes hyphens to underscores, e.g. `http.response.header.content_length`. When stable HTTP semconv is enabled (via `OTEL_SEMCONV_STABILITY_OPT_IN`), hyphens are no longer changed, e.g. `http.response.header.content-length`.
* feat(api-logs, sdk-logs)!: add `enabled` method to Logger interface and implement it in logs API and SDK [#6371](https://github.com/open-telemetry/opentelemetry-js/pull/6371) @david-luna
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've done a release since, so this needs to be moved up to the top section.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit 5e5ed85

@david-luna david-luna enabled auto-merge March 30, 2026 08:16
@david-luna
Copy link
Copy Markdown
Contributor Author

@open-telemetry/browser-maintainers could you please check if all is fine?

@david-luna david-luna added this pull request to the merge queue Mar 30, 2026
Merged via the queue into open-telemetry:main with commit 786eefd Mar 30, 2026
27 checks passed
@david-luna david-luna deleted the add-logger-enabled branch March 30, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[api-logs, sdk-logs] implement Logger#enabled

5 participants