diff --git a/docs/configure.md b/docs/configure.md index e935177..9c2e4bc 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -34,12 +34,22 @@ Because the Elastic Distribution of OpenTelemetry Python is an extension of Open EDOT Python supports all configuration options listed in the [OpenTelemetry General SDK Configuration documentation](https://opentelemetry.io/docs/languages/sdk-configuration/general/) and [OpenTelemetry Python](https://opentelemetry.io/docs/languages/python). +#### Logs + +Exporting logs from the Python `logging` module is disabled by default and gated under a configuration environment variable: + +```sh +export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true +``` + +#### Differences from OpenTelemetry Python + EDOT Python uses different defaults than OpenTelemetry Python for the following configuration options: | Option | EDOT Python default | OpenTelemetry Python default | |---|---|---| | `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` | `process_runtime,os,otel,telemetry_distro` | `otel` | - +| `OTEL_LOGS_EXPORTER` | `otlp` | _no default_ | ### Configuration options that are _only_ available in EDOT Python diff --git a/src/elasticotel/distro/__init__.py b/src/elasticotel/distro/__init__.py index 72736b8..1a26e87 100644 --- a/src/elasticotel/distro/__init__.py +++ b/src/elasticotel/distro/__init__.py @@ -18,6 +18,7 @@ from logging import getLogger from opentelemetry.environment_variables import ( + OTEL_LOGS_EXPORTER, OTEL_METRICS_EXPORTER, OTEL_TRACES_EXPORTER, ) @@ -72,5 +73,6 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs): def _configure(self, **kwargs): os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp") os.environ.setdefault(OTEL_METRICS_EXPORTER, "otlp") + os.environ.setdefault(OTEL_LOGS_EXPORTER, "otlp") os.environ.setdefault(OTEL_EXPORTER_OTLP_PROTOCOL, "grpc") os.environ.setdefault(OTEL_EXPERIMENTAL_RESOURCE_DETECTORS, "process_runtime,os,otel,telemetry_distro") diff --git a/tests/distro/test_distro.py b/tests/distro/test_distro.py index 31ddcc6..89e65c4 100644 --- a/tests/distro/test_distro.py +++ b/tests/distro/test_distro.py @@ -20,6 +20,7 @@ from elasticotel.distro import ElasticOpenTelemetryDistro from elasticotel.distro.environment_variables import ELASTIC_OTEL_SYSTEM_METRICS_ENABLED from opentelemetry.environment_variables import ( + OTEL_LOGS_EXPORTER, OTEL_METRICS_EXPORTER, OTEL_TRACES_EXPORTER, ) @@ -36,6 +37,7 @@ def test_default_configuration(self): distro.configure() self.assertEqual("otlp", os.environ.get(OTEL_TRACES_EXPORTER)) self.assertEqual("otlp", os.environ.get(OTEL_METRICS_EXPORTER)) + self.assertEqual("otlp", os.environ.get(OTEL_LOGS_EXPORTER)) self.assertEqual("grpc", os.environ.get(OTEL_EXPORTER_OTLP_PROTOCOL)) self.assertEqual( "process_runtime,os,otel,telemetry_distro", os.environ.get(OTEL_EXPERIMENTAL_RESOURCE_DETECTORS)