Skip to content

Commit 276e8b3

Browse files
authored
Merge branch 'main' into status-code-description
2 parents bdba710 + 94e3a4a commit 276e8b3

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
([#1656])(https://github.com/open-telemetry/opentelemetry-python/pull/1656)
2525
- Rename `DefaultSpan` to `NonRecordingSpan`
2626
([#1661])(https://github.com/open-telemetry/opentelemetry-python/pull/1661)
27+
- Fixed distro configuration with `OTEL_TRACES_EXPORTER` env var set to `otlp`
28+
([#1657])(https://github.com/open-telemetry/opentelemetry-python/pull/1657)
2729
- Moving `Getter`, `Setter` and `TextMapPropagator` out of `opentelemetry.trace.propagation` and
2830
into `opentelemetry.propagators`
2931
([#1662])(https://github.com/open-telemetry/opentelemetry-python/pull/1662)

opentelemetry-distro/src/opentelemetry/distro/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _get_exporter_names() -> Sequence[str]:
6767
)
6868

6969
if EXPORTER_OTLP in exporters:
70-
exporters.pop(EXPORTER_OTLP)
70+
exporters.remove(EXPORTER_OTLP)
7171
exporters.add(EXPORTER_OTLP_SPAN)
7272

7373
return list(exporters)

opentelemetry-distro/tests/test_configurator.py

+15
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@
1818
from unittest.mock import patch
1919

2020
from opentelemetry.distro import (
21+
EXPORTER_OTLP,
22+
EXPORTER_OTLP_SPAN,
23+
_get_exporter_names,
2124
_get_id_generator,
2225
_import_id_generator,
2326
_init_tracing,
2427
)
2528
from opentelemetry.environment_variables import (
2629
OTEL_PYTHON_ID_GENERATOR,
2730
OTEL_PYTHON_SERVICE_NAME,
31+
OTEL_TRACES_EXPORTER,
2832
)
2933
from opentelemetry.sdk.resources import Resource
3034
from opentelemetry.sdk.trace.id_generator import IdGenerator, RandomIdGenerator
@@ -143,3 +147,14 @@ def test_trace_init_custom_id_generator(self, mock_iter_entry_points):
143147
_init_tracing({}, id_generator)
144148
provider = self.set_provider_mock.call_args[0][0]
145149
self.assertIsInstance(provider.id_generator, CustomIdGenerator)
150+
151+
152+
class TestExporterNames(TestCase):
153+
def test_otlp_exporter_overwrite(self):
154+
for exporter in [EXPORTER_OTLP, EXPORTER_OTLP_SPAN]:
155+
with patch.dict(environ, {OTEL_TRACES_EXPORTER: exporter}):
156+
self.assertEqual(_get_exporter_names(), [EXPORTER_OTLP_SPAN])
157+
158+
@patch.dict(environ, {OTEL_TRACES_EXPORTER: "jaeger,zipkin"})
159+
def test_multiple_exporters(self):
160+
self.assertEqual(sorted(_get_exporter_names()), ["jaeger", "zipkin"])

0 commit comments

Comments
 (0)