opentelemetry-go-contrib
opentelemetry-go-contrib copied to clipboard
Provide ScopeName constant for logging bridges
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.
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.
Could you maybe clarify what the appropriate scope name would be for a global slog logger that uses otelslog as bridge? @MrAlias
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.