|
18 | 18 | from unittest.mock import patch
|
19 | 19 |
|
20 | 20 | from opentelemetry.distro import (
|
| 21 | + EXPORTER_OTLP, |
| 22 | + EXPORTER_OTLP_SPAN, |
| 23 | + _get_exporter_names, |
21 | 24 | _get_id_generator,
|
22 | 25 | _import_id_generator,
|
23 | 26 | _init_tracing,
|
24 | 27 | )
|
25 | 28 | from opentelemetry.environment_variables import (
|
26 | 29 | OTEL_PYTHON_ID_GENERATOR,
|
27 | 30 | OTEL_PYTHON_SERVICE_NAME,
|
| 31 | + OTEL_TRACES_EXPORTER, |
28 | 32 | )
|
29 | 33 | from opentelemetry.sdk.resources import Resource
|
30 | 34 | 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):
|
143 | 147 | _init_tracing({}, id_generator)
|
144 | 148 | provider = self.set_provider_mock.call_args[0][0]
|
145 | 149 | 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