Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE: Auto instrumentation paramaters proposal #2439

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions opentelemetry-distro/src/opentelemetry/distro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ def _configure(self, **kwargs):
os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp")
os.environ.setdefault(OTEL_METRICS_EXPORTER, "otlp")
os.environ.setdefault(OTEL_EXPORTER_OTLP_PROTOCOL, "grpc")
# Since the distro sets these env vars, these params are not necesary.
# However they could replace these env var defaults.
# Otherwise, they just serve as an example.
configuration_kwargs = {}
return configuration_kwargs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def _load_instrumentors(distro):
entry_point.load()()


def _load_configurators():
def _load_configurators(**configuration_kwargs):
configuration_kwargs["auto_instrumentation_version"] =__version__
configurator_name = environ.get(OTEL_PYTHON_CONFIGURATOR, None)
configured = None
for entry_point in iter_entry_points("opentelemetry_configurator"):
Expand All @@ -110,7 +111,7 @@ def _load_configurators():
configurator_name is None
or configurator_name == entry_point.name
):
entry_point.load()().configure(auto_instrumentation_version=__version__) # type: ignore
entry_point.load()().configure(**configuration_kwargs) # type: ignore
configured = entry_point.name
else:
_logger.warning(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def initialize():

try:
distro = _load_distro()
distro.configure()
_load_configurators()
configuration_kwargs = distro.configure()
_load_configurators(**configuration_kwargs)
_load_instrumentors(distro)
except Exception: # pylint: disable=broad-except
logger.exception("Failed to auto initialize opentelemetry")
Expand Down
Loading