Skip to content

Commit 2feaeb1

Browse files
committed
distro: set OTEL_LOGS_EXPORTER to oltp by default
To match the other signals
1 parent 2f2d7bf commit 2feaeb1

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

docs/configure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ EDOT Python supports all configuration options listed in the [OpenTelemetry Gene
3939
Exporting logs from the Python `logging` module is disabled by default and gated under a configuration environment variable:
4040

4141
```sh
42-
export OTEL_LOGS_EXPORTER=otlp
4342
export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
4443
```
4544

@@ -50,6 +49,7 @@ EDOT Python uses different defaults than OpenTelemetry Python for the following
5049
| Option | EDOT Python default | OpenTelemetry Python default |
5150
|---|---|---|
5251
| `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` | `process_runtime,os,otel,telemetry_distro` | `otel` |
52+
| `OTEL_LOGS_EXPORTER` | `otlp` | |
5353

5454
### Configuration options that are _only_ available in EDOT Python
5555

src/elasticotel/distro/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from logging import getLogger
1919

2020
from opentelemetry.environment_variables import (
21+
OTEL_LOGS_EXPORTER,
2122
OTEL_METRICS_EXPORTER,
2223
OTEL_TRACES_EXPORTER,
2324
)
@@ -72,5 +73,6 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs):
7273
def _configure(self, **kwargs):
7374
os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp")
7475
os.environ.setdefault(OTEL_METRICS_EXPORTER, "otlp")
76+
os.environ.setdefault(OTEL_LOGS_EXPORTER, "otlp")
7577
os.environ.setdefault(OTEL_EXPORTER_OTLP_PROTOCOL, "grpc")
7678
os.environ.setdefault(OTEL_EXPERIMENTAL_RESOURCE_DETECTORS, "process_runtime,os,otel,telemetry_distro")

tests/distro/test_distro.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from elasticotel.distro import ElasticOpenTelemetryDistro
2121
from elasticotel.distro.environment_variables import ELASTIC_OTEL_SYSTEM_METRICS_ENABLED
2222
from opentelemetry.environment_variables import (
23+
OTEL_LOGS_EXPORTER,
2324
OTEL_METRICS_EXPORTER,
2425
OTEL_TRACES_EXPORTER,
2526
)
@@ -36,6 +37,7 @@ def test_default_configuration(self):
3637
distro.configure()
3738
self.assertEqual("otlp", os.environ.get(OTEL_TRACES_EXPORTER))
3839
self.assertEqual("otlp", os.environ.get(OTEL_METRICS_EXPORTER))
40+
self.assertEqual("otlp", os.environ.get(OTEL_LOGS_EXPORTER))
3941
self.assertEqual("grpc", os.environ.get(OTEL_EXPORTER_OTLP_PROTOCOL))
4042
self.assertEqual(
4143
"process_runtime,os,otel,telemetry_distro", os.environ.get(OTEL_EXPERIMENTAL_RESOURCE_DETECTORS)

0 commit comments

Comments
 (0)