in src/elasticotel/distro/__init__.py [0:0]
def load_instrumentor(self, entry_point: EntryPoint, **kwargs):
# When running in the k8s operator loading of an instrumentor may fail because the environment
# in which python extensions are built does not match the one from the running container but
# ImportErrors raised here are handled by the autoinstrumentation code
instrumentor_class: BaseInstrumentor = entry_point.load()
instrumentor_kwargs = {}
if instrumentor_class == SystemMetricsInstrumentor:
system_metrics_configuration = os.environ.get(ELASTIC_OTEL_SYSTEM_METRICS_ENABLED, "false")
system_metrics_enabled = system_metrics_configuration.lower() == "true"
if not system_metrics_enabled:
instrumentor_kwargs["config"] = {
k: v for k, v in SYSTEM_METRICS_DEFAULT_CONFIG.items() if k.startswith("process.runtime")
}
instrumentor_class(**instrumentor_kwargs).instrument(**kwargs)