Skip to content

opentelemetry-api: review get_logger documentation #4507

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,29 @@ def get_logger(
) -> Logger:
"""Returns a `Logger` for use by the given instrumentation library.

For any two calls it is undefined whether the same or different
`Logger` instances are returned, even for different library names.
Calls with the same arguments should return the same `Logger` instance.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this does not match what the sdk is doing though

Copy link
Member

@emdneto emdneto Mar 28, 2025

Choose a reason for hiding this comment

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

Do you mean there's something wrong with the logic previously implemented by #4208 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean this #4318 (comment)


This function may return different `Logger` types (e.g. a no-op logger
vs. a functional logger).

Args:
name: The name of the instrumenting module.
``__name__`` may not be used as this can result in
different logger names if the loggers are in different files.
It is better to use a fixed string that can be imported where
needed and used consistently as the name of the logger.

This should *not* be the name of the module that is
instrumented but the name of the module doing the instrumentation.
name: The name of the instrumenting module, package or class.
This should *not* be the name of the module, package or class that is
instrumented but the name of the code doing the instrumentation.
E.g., instead of ``"requests"``, use
``"opentelemetry.instrumentation.requests"``.

For log sources which define a logger name (e.g. logging.Logger.name)
the Logger Name should be recorded as the instrumentation scope name.

version: Optional. The version string of the
instrumenting library. Usually this should be the same as
``importlib.metadata.version(instrumenting_library_name)``.

schema_url: Optional. Specifies the Schema URL of the emitted telemetry.

attributes: Optional. Specifies the instrumentation scope attributes to
associate with emitted telemetry.
"""


Expand Down
Loading