File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
opentelemetry-instrumentation/src/opentelemetry/instrumentation Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,9 @@ otlp = [
4040[project .entry-points .opentelemetry_configurator ]
4141configurator = " opentelemetry.distro:OpenTelemetryConfigurator"
4242
43+ [project .entry-points .opentelemetry_customizer ]
44+ customizer = " opentelemetry.distro:OpenTelemetryCustomizer"
45+
4346[project .entry-points .opentelemetry_distro ]
4447distro = " opentelemetry.distro:OpenTelemetryDistro"
4548
Original file line number Diff line number Diff line change 1919 OTEL_METRICS_EXPORTER ,
2020 OTEL_TRACES_EXPORTER ,
2121)
22+ from opentelemetry .sdk ._config_customizer import _BaseConfiguratorCustomizer
2223from opentelemetry .instrumentation .distro import BaseDistro
2324from opentelemetry .sdk ._configuration import _OTelSDKConfigurator
2425from opentelemetry .sdk .environment_variables import OTEL_EXPORTER_OTLP_PROTOCOL
2728class OpenTelemetryConfigurator (_OTelSDKConfigurator ):
2829 pass
2930
31+ class OpenTelemetryCustomizer (_BaseConfiguratorCustomizer ):
32+ pass
3033
3134class OpenTelemetryDistro (BaseDistro ):
3235 """
Original file line number Diff line number Diff line change 2323from opentelemetry .instrumentation .environment_variables import (
2424 OTEL_PYTHON_CONFIGURATOR ,
2525 OTEL_PYTHON_DISABLED_INSTRUMENTATIONS ,
26+ OTEL_PYTHON_CUSTOMIZER ,
2627 OTEL_PYTHON_DISTRO ,
2728)
2829from opentelemetry .instrumentation .version import __version__
@@ -133,6 +134,14 @@ def _load_instrumentors(distro):
133134
134135
135136def _load_configurators ():
137+ customizer = None
138+ if environ .get (OTEL_PYTHON_CUSTOMIZER , None ):
139+ for entry_point in entry_points (
140+ group = "opentelemetry_customizer" ,
141+ name = environ .get (OTEL_PYTHON_CUSTOMIZER ),
142+ ):
143+ customizer = entry_point .load ()()
144+ break
136145 configurator_name = environ .get (OTEL_PYTHON_CONFIGURATOR , None )
137146 configured = None
138147 for entry_point in entry_points (group = "opentelemetry_configurator" ):
@@ -149,7 +158,8 @@ def _load_configurators():
149158 or configurator_name == entry_point .name
150159 ):
151160 entry_point .load ()().configure (
152- auto_instrumentation_version = __version__
161+ auto_instrumentation_version = __version__ ,
162+ customizer = customizer ,
153163 ) # type: ignore
154164 configured = entry_point .name
155165 else :
Original file line number Diff line number Diff line change 2626"""
2727.. envvar:: OTEL_PYTHON_CONFIGURATOR
2828"""
29+ OTEL_PYTHON_CUSTOMIZER = "OTEL_PYTHON_CUSTOMIZER"
30+ """
31+ .. envvar:: OTEL_PYTHON_CUSTOMIZER
32+ """
You can’t perform that action at this time.
0 commit comments