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 = [
40
40
[project.entry-points.opentelemetry_configurator]
41
41
configurator = "opentelemetry.distro:OpenTelemetryConfigurator"
42
42
43
+ [project.entry-points.opentelemetry_customizer]
44
+ customizer = "opentelemetry.distro:OpenTelemetryCustomizer"
45
+
43
46
[project.entry-points.opentelemetry_distro]
44
47
distro = "opentelemetry.distro:OpenTelemetryDistro"
45
48
Original file line number Diff line number Diff line change 19
19
OTEL_METRICS_EXPORTER,
20
20
OTEL_TRACES_EXPORTER,
21
21
)
22
+ from opentelemetry.sdk._config_customizer import _BaseConfiguratorCustomizer
22
23
from opentelemetry.instrumentation.distro import BaseDistro
23
24
from opentelemetry.sdk._configuration import _OTelSDKConfigurator
24
25
from opentelemetry.sdk.environment_variables import OTEL_EXPORTER_OTLP_PROTOCOL
27
28
class OpenTelemetryConfigurator(_OTelSDKConfigurator):
28
29
pass
29
30
31
+ class OpenTelemetryCustomizer(_BaseConfiguratorCustomizer):
32
+ pass
30
33
31
34
class OpenTelemetryDistro(BaseDistro):
32
35
"""
Original file line number Diff line number Diff line change 23
23
from opentelemetry.instrumentation.environment_variables import (
24
24
OTEL_PYTHON_CONFIGURATOR,
25
25
OTEL_PYTHON_DISABLED_INSTRUMENTATIONS,
26
+ OTEL_PYTHON_CUSTOMIZER,
26
27
OTEL_PYTHON_DISTRO,
27
28
)
28
29
from opentelemetry.instrumentation.version import __version__
@@ -133,6 +134,14 @@ def _load_instrumentors(distro):
133
134
134
135
135
136
def _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
136
145
configurator_name = environ.get(OTEL_PYTHON_CONFIGURATOR, None)
137
146
configured = None
138
147
for entry_point in entry_points(group="opentelemetry_configurator"):
@@ -149,7 +158,8 @@ def _load_configurators():
149
158
or configurator_name == entry_point.name
150
159
):
151
160
entry_point.load()().configure(
152
- auto_instrumentation_version=__version__
161
+ auto_instrumentation_version=__version__,
162
+ customizer=customizer,
153
163
) # type: ignore
154
164
configured = entry_point.name
155
165
else:
Original file line number Diff line number Diff line change 26
26
"""
27
27
.. envvar:: OTEL_PYTHON_CONFIGURATOR
28
28
"""
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