Commit 49cd9643 authored by Yury Matveev's avatar Yury Matveev
Browse files

Merge branch 'support-otel-sdk-logger-names' into 'maintenance/10.0.x'

10.0.x maintenance:  Support specifying OpenTelemetry logger names

See merge request !874
parents f92766d8 1608615a
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -316,6 +316,15 @@ to do this. Set the value to `fatal` before starting your application to hide t

The standard Python logging levels are all options: `critical`, `fatal`, `error`, `warning`, `info`, `debug`, `notset`.

The name of the [opentelemetry-python](https://github.com/open-telemetry/opentelemetry-python) logger used for
this may change in future, so there is a second environment variable, `PYTANGO_TELEMETRY_SDK_LOGGER_NAMES`, which
can be set to a comma-seperated list of logger names.  Defaults are used if the environment variable is empty or
not set.

(As at version 1.35.0, opentelemetry-python
[does not support](https://github.com/open-telemetry/opentelemetry-python/issues/1059) its own `OTEL_LOG_LEVEL`
environment variable).

## How to reduce the number of traces being stored

Storing all traces from all Tango devices in your facility is probably not feasible.
+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+10 −1
Original line number Diff line number Diff line
@@ -2344,7 +2344,16 @@ try:
            level_str = ApiUtil.get_env_var("PYTANGO_TELEMETRY_SDK_LOG_LEVEL")
            if level_str:
                level_int = logging.getLevelNamesMapping()[level_str.upper()]
                logging.getLogger("opentelemetry.sdk.trace.export").setLevel(level_int)
                names_csv = ApiUtil.get_env_var("PYTANGO_TELEMETRY_SDK_LOGGER_NAMES")
                if names_csv:
                    names = names_csv.split(",")
                else:
                    names = [
                        "opentelemetry.sdk.trace.export",
                        "opentelemetry.sdk._shared_internal",
                    ]
                for name in names:
                    logging.getLogger(name).setLevel(level_int)
                _telemetry.set_log_level(level_str)

        _set_telemetry_sdk_log_level()