Skip to content

Commit 320d69f

Browse files
authored
Fix get exporter names condition (#1707)
1 parent f5d10d4 commit 320d69f

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6868
([#1695](https://github.com/open-telemetry/opentelemetry-python/pull/1695))
6969
- Change Jaeger exporters to obtain service.name from span
7070
([#1703](https://github.com/open-telemetry/opentelemetry-python/pull/1703))
71+
- Fixed an unset `OTEL_TRACES_EXPORTER` resulting in an error
72+
([#1707](https://github.com/open-telemetry/opentelemetry-python/pull/1707))
7173

7274
### Removed
7375
- Removed unused `get_hexadecimal_trace_id` and `get_hexadecimal_span_id` methods.

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ def _get_exporter_names() -> Sequence[str]:
5050

5151
exporters = set()
5252

53-
if (
54-
trace_exporters is not None
55-
or trace_exporters.lower().strip() != "none"
56-
):
53+
if trace_exporters and trace_exporters.lower().strip() != "none":
5754
exporters.update(
5855
{
5956
trace_exporter.strip()

opentelemetry-distro/tests/test_configurator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,15 @@ def test_otlp_exporter_overwrite(self):
167167
@patch.dict(environ, {OTEL_TRACES_EXPORTER: "jaeger,zipkin"})
168168
def test_multiple_exporters(self):
169169
self.assertEqual(sorted(_get_exporter_names()), ["jaeger", "zipkin"])
170+
171+
@patch.dict(environ, {OTEL_TRACES_EXPORTER: "none"})
172+
def test_none_exporters(self):
173+
self.assertEqual(sorted(_get_exporter_names()), [])
174+
175+
@patch.dict(environ, {}, clear=True)
176+
def test_no_exporters(self):
177+
self.assertEqual(sorted(_get_exporter_names()), [])
178+
179+
@patch.dict(environ, {OTEL_TRACES_EXPORTER: ""})
180+
def test_empty_exporters(self):
181+
self.assertEqual(sorted(_get_exporter_names()), [])

0 commit comments

Comments
 (0)