open-telemetry / open-telemetry/opentelemetry-python

Allow configuration of inner SDK `Logger` using `LoggingHandler`

Open
#4,060 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request logging sdk
Dominant language
Python
Stars
2.6k
Forks
1k
Avg merge
4d 15h
Merged PRs (30d)
19

Description

Is your feature request related to a problem?

Currently, our recommended approach for collecting logs using the sdk is through the LoggingHandler, which encapsulates a LoggerProvider and instantiates a OT SDK Logger by calling get_logger internally. This is synonomous to tracing's get_tracer and metrics get_meter, which accept name, version and schema url to construct an InstrumentationScope. The different with metrics and tracing is that the recommended approach is to construct Tracer and Meter manually by using those apis instead of through a handler. So with our current recommendation, users who use LoggingHandler to instantiate an sdk Logger by default will always get __name__ as the instrumentation module name (which is hardcoded to the name of the file), blank library version and blank schema url. We should probably provide a way for users to populate InstrumentationScope values through the use of LoggingHandler.

Describe the solution you'd like

Most likely have to add a parameter to allow for configuration of the inner sdk Logger in LoggingHandler.

Describe alternatives you've considered

No response

Additional Context

No response

Would you like to implement a fix?

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/examples/logs/example.py and the LoggingHandler implementation, then inspect opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/init.py around Logger and get_logger. Determine how LoggingHandler should expose instrumentation scope values, and add coverage showing that configured name, version, and schema URL reach the inner SDK Logger.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.