From 51a606ed36cc09df745d3329d85c2c50df009b9b Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 26 Mar 2025 11:42:42 +0100 Subject: [PATCH] opentelemetry-api: review get_logger documentation --- .../opentelemetry/_logs/_internal/__init__.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py b/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py index f20bd8507e5..9cf5659a74d 100644 --- a/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py +++ b/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py @@ -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. 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. """