Skip to content

Commit

Permalink
Merge pull request #146 from solarwindscloud/NH-29380-add-default-ote…
Browse files Browse the repository at this point in the history
…l-python-log-format

NH-29380 Add distro default OTEL_PYTHON_LOG_FORMAT
  • Loading branch information
tammy-baylis-swi authored May 23, 2023
2 parents e86dc11 + 7cfc48a commit 9ee1f15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ install_requires =
opentelemetry-api == 1.18.0
opentelemetry-sdk == 1.18.0
opentelemetry-instrumentation == 0.39b0
opentelemetry-instrumentation-logging == 0.39b0
packages = solarwinds_apm, solarwinds_apm.api, solarwinds_apm.certs, solarwinds_apm.extension

[options.package_data]
Expand Down
7 changes: 7 additions & 0 deletions solarwinds_apm/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
OTEL_TRACES_EXPORTER,
)
from opentelemetry.instrumentation.distro import BaseDistro
from opentelemetry.instrumentation.logging.environment_variables import (
OTEL_PYTHON_LOG_FORMAT,
)

from solarwinds_apm.apm_constants import (
INTL_SWO_DEFAULT_PROPAGATORS,
Expand All @@ -31,3 +34,7 @@ def _configure(self, **kwargs):
environ.setdefault(
OTEL_PROPAGATORS, ",".join(INTL_SWO_DEFAULT_PROPAGATORS)
)
environ.setdefault(
OTEL_PYTHON_LOG_FORMAT,
"%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s",
)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ deps =
opentelemetry-api
opentelemetry-sdk
opentelemetry-instrumentation
opentelemetry-instrumentation-logging
pylint
flake8
isort
Expand Down

0 comments on commit 9ee1f15

Please sign in to comment.