Skip to content

Commit 43e1dc3

Browse files
docs: cite configuration to enable logs exporting (#153)
* docs: cite configuration to enabled logs exporting * You also need to set the protocol explicitly * distro: set OTEL_LOGS_EXPORTER to oltp by default To match the other signals * Update docs/configure.md Co-authored-by: Colleen McGinnis <[email protected]> --------- Co-authored-by: Colleen McGinnis <[email protected]>
1 parent 15ad8be commit 43e1dc3

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

docs/configure.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,22 @@ Because the Elastic Distribution of OpenTelemetry Python is an extension of Open
3434

3535
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).
3636

37+
#### Logs
38+
39+
Exporting logs from the Python `logging` module is disabled by default and gated under a configuration environment variable:
40+
41+
```sh
42+
export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
43+
```
44+
45+
#### Differences from OpenTelemetry Python
46+
3747
EDOT Python uses different defaults than OpenTelemetry Python for the following configuration options:
3848

3949
| Option | EDOT Python default | OpenTelemetry Python default |
4050
|---|---|---|
4151
| `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` | `process_runtime,os,otel,telemetry_distro` | `otel` |
42-
52+
| `OTEL_LOGS_EXPORTER` | `otlp` | _no default_ |
4353

4454
### Configuration options that are _only_ available in EDOT Python
4555

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)