Skip to content
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

Add Enabled method to Logger #4020

Merged
merged 14 commits into from
May 28, 2024
Merged

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Apr 29, 2024

Fixes #3917

Knowing if a LogRecord will be dropped prior to performing computationally expensive operations helps developers using the Logs Bridge API avoid wasted and expensive work. This adds and Enabled API to the Logger to provide this functionality.

This is related to #3877. In that PR Loggers may become entirely disabled. The Enabled method included here will help users determine this state.

Prototypes

@MrAlias MrAlias added the spec:logs Related to the specification/logs directory label Apr 29, 2024
@MrAlias MrAlias marked this pull request as ready for review April 29, 2024 20:06
@MrAlias MrAlias requested review from a team as code owners April 29, 2024 20:06
Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Nice! Was coincidentally just working on a local branch for this. I think we ought to have symmetry across metrics and traces, but fine pursuing that in a separate PR.

specification/logs/bridge-api.md Outdated Show resolved Hide resolved
specification/logs/bridge-api.md Show resolved Hide resolved
Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @MrAlias!

@reyang reyang added the area:api Cross language API specification issue label Apr 29, 2024
specification/logs/bridge-api.md Outdated Show resolved Hide resolved
Copy link

linux-foundation-easycla bot commented May 17, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Clarify the true/false expectation and add optional stale value return.
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

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

LGTM.

PS. I created #4055

specification/logs/bridge-api.md Outdated Show resolved Hide resolved
carlosalberto pushed a commit that referenced this pull request May 23, 2024
Per
#4020 (comment)

Some people confuse SHALL with SHOULD.

---------

Co-authored-by: Reiley Yang <[email protected]>
MrAlias and others added 2 commits May 23, 2024 08:22
Leave the return value implementation for implementations specification.
@cijothomas
Copy link
Member

Re-requested review from @jack-berg and @reyang as the contents have changed since their approvals.

@reyang reyang merged commit f3aeadb into open-telemetry:main May 28, 2024
6 checks passed
@MrAlias MrAlias deleted the logger-enabled branch May 28, 2024 16:26
jack-berg added a commit that referenced this pull request Jun 3, 2024
…#4063)

Builds off #4020 to extend the `Enabled` API to `Tracer` and metrics
`Instrument`.

Adds language to Log SDK, Metrics SDK, and Trace SDK for how scope
config is used to resolve the `Enabled` operation.

This was discussed in #3867 but punted on in #3877 as [discussed
here](#3877 (comment)).

---------

Co-authored-by: Robert Pająk <[email protected]>
Co-authored-by: Trask Stalnaker <[email protected]>
Co-authored-by: Reiley Yang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api Cross language API specification issue spec:logs Related to the specification/logs directory
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add an Enabled method to the Logger