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

Provide ScopeName constant for logging bridges #5927

Open
galecore opened this issue Jul 18, 2024 · 3 comments
Open

Provide ScopeName constant for logging bridges #5927

galecore opened this issue Jul 18, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@galecore
Copy link

galecore commented Jul 18, 2024

Problem Statement

Most of the integrations in contrib automatically provide some ScopeName when working with top-level telemetry providers.
Example search for ScopeName const yields lots of examples - https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-go-contrib%20ScopeName&type=code

At the same time, logging bridges don't have these scope names, leaving the user in charge of setting the package for LoggerProvider.Logger(...). Why is there no ScopeName defined for logging bridges? Is it expected that callers hardcode and pass repo module names when setting up logging bridges?

Proposed Solution

Add const ScopeName = "..." for every logging bridge package - otelslog, etc.

Alternatives

Hint on the expected value for LoggerProvider.Logger(...) when using log bridges in examples and/or documentation.

Prior Art

Example search for ScopeName const yields lots of examples - https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-go-contrib%20ScopeName&type=code

It's not rare to see TracerProvider.Tracer(ScopeName) or MeterProvider.Meter(ScopeName)calls in contrib.

Additional Context

Add any other context or screenshots about the feature request here.

@galecore galecore added the enhancement New feature or request label Jul 18, 2024
@MrAlias
Copy link
Contributor

MrAlias commented Jul 18, 2024

The logging bridge is not meant to provide the scope name. It is a bridge, not instrumentation.

The instrumentation that uses the logging library backed by a bridge needs to provide an appropriate scope name.

@galecore
Copy link
Author

Could you maybe clarify what the appropriate scope name would be for a global slog logger that uses otelslog as bridge? @MrAlias

@MrAlias
Copy link
Contributor

MrAlias commented Aug 12, 2024

The provided name needs to uniquely identify the code being logged. This is most commonly the package name of the code.

https://pkg.go.dev/go.opentelemetry.io/contrib/bridges/otelslog#NewHandler

The specifics are going to depend on what your code-base is named and how it is structured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants