-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(api-logs, sdk-logs)!: add Logger#enabled method #6371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
david-luna
merged 27 commits into
open-telemetry:main
from
david-luna:add-logger-enabled
Mar 30, 2026
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e4f9653
feat(api-lods, sdk-logs): add Logger#enabled method
david-luna cbaabf1
chore: add more tests
david-luna d5c32d8
chore: add changelog entry
david-luna 073c3dc
fix: fix changelog
david-luna 71806ab
feat(sdk-logs): check logger config in Logger#enable
david-luna 9b35e35
Merge branch 'main' into add-logger-enabled
david-luna 08b15b1
chore: add enabled in log record processors
david-luna 4d4cd2b
chore: add enabled in session log record processor
david-luna 76cba2a
chore: add tests to session log record processor
david-luna 5d3afbf
chore: add tests to multi log processor
david-luna 733bd6f
chore: made enabled optional for processors
david-luna 8346a29
chore: remove code
david-luna e0b3db0
chore: remove code from test stubs
david-luna a7099e1
chore: revert changes in session processor
david-luna 7ffd0d6
Update experimental/packages/api-logs/src/types/Logger.ts
david-luna 6afe03b
Update experimental/packages/api-logs/src/ProxyLogger.ts
david-luna b8c4791
fix: handle UNSPECIFIED level
david-luna 4a28b26
Merge branch 'main' into add-logger-enabled
david-luna 5331ea3
chore: update types
david-luna 0126595
fix: fix lint issues
david-luna b956007
Apply suggestion from @trentm
david-luna feaafd9
chore: improve trace based logic
david-luna 6ba5fa5
Merge branch 'add-logger-enabled' of github.com:david-luna/openteleme…
david-luna 4dd2bd4
Update experimental/CHANGELOG.md
david-luna 443c67e
Merge branch 'main' into add-logger-enabled
david-luna 5e5ed85
chore: update changelog
david-luna 2f93dd0
Merge branch 'add-logger-enabled' of github.com:david-luna/openteleme…
david-luna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,12 @@ | |
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import type { InstrumentationScope } from '@opentelemetry/core'; | ||
| import { callWithTimeout } from '@opentelemetry/core'; | ||
| import type { Context } from '@opentelemetry/api'; | ||
| import type { LogRecordProcessor } from './LogRecordProcessor'; | ||
| import type { SdkLogRecord } from './export/SdkLogRecord'; | ||
| import type { SeverityNumber } from '@opentelemetry/api-logs'; | ||
|
|
||
| /** | ||
| * Implementation of the {@link LogRecordProcessor} that simply forwards all | ||
|
|
@@ -41,4 +43,18 @@ export class MultiLogRecordProcessor implements LogRecordProcessor { | |
| public async shutdown(): Promise<void> { | ||
| await Promise.all(this.processors.map(processor => processor.shutdown())); | ||
| } | ||
|
|
||
| public enabled(options: { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| context: Context; | ||
| instrumentationScope: InstrumentationScope; | ||
| severityNumber?: SeverityNumber; | ||
| eventName?: string; | ||
| }): boolean { | ||
| for (const processor of this.processors) { | ||
| if (!processor.enabled || processor.enabled(options)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.