Skip to content

Commit 728de50

Browse files
committed
elasticotel: remove handling of instrumentor loading
That is now handled by the upstream autoinstrumentation code.
1 parent e242f3f commit 728de50

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

src/elasticotel/distro/__init__.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,9 @@ class ElasticOpenTelemetryConfigurator(_OTelSDKConfigurator):
4848
class ElasticOpenTelemetryDistro(BaseDistro):
4949
def load_instrumentor(self, entry_point: EntryPoint, **kwargs):
5050
# When running in the k8s operator loading of an instrumentor may fail because the environment
51-
# in which python extensions are built does not match the one from the running container.
52-
# There are at least two cases:
53-
# - different python version
54-
# - different kind of wheels, e.g. manylinux vs musllinux
55-
# To avoid the distro loading to fail catch ImportError here, that is the kind of exception we see
56-
# when loading shared objects or cython extensions fails.
57-
try:
58-
instrumentor_class: BaseInstrumentor = entry_point.load()
59-
except ImportError:
60-
logger.exception("Instrumenting of %s failed", entry_point.name)
61-
return
51+
# in which python extensions are built does not match the one from the running container but
52+
# ImportErrors raised here are handled by the autoinstrumentation code
53+
instrumentor_class: BaseInstrumentor = entry_point.load()
6254

6355
instrumentor_kwargs = {}
6456
if instrumentor_class == SystemMetricsInstrumentor:

tests/distro/test_distro.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,3 @@ def test_load_instrumentor_default_kwargs_for_instrumentors(self):
8585
distro.load_instrumentor(entryPoint_mock)
8686

8787
instrumentor_mock.assert_called_once_with()
88-
89-
def test_load_instrumentor_handles_import_error_from_instrumentor_loading(self):
90-
distro = ElasticOpenTelemetryDistro()
91-
entryPoint_mock = mock.Mock()
92-
entryPoint_mock.load.side_effect = ImportError
93-
94-
distro.load_instrumentor(entryPoint_mock)
95-
96-
def test_load_instrumentor_forwards_exceptions(self):
97-
distro = ElasticOpenTelemetryDistro()
98-
entryPoint_mock = mock.Mock()
99-
entryPoint_mock.load.side_effect = ValueError
100-
101-
with self.assertRaises(ValueError):
102-
distro.load_instrumentor(entryPoint_mock)

0 commit comments

Comments
 (0)