Skip to content

Add warning when no opentelemetry_configurator entry points found#4543

Open
Manvi2402 wants to merge 2 commits intoopen-telemetry:mainfrom
Manvi2402:warn-missing-configurator-distro
Open

Add warning when no opentelemetry_configurator entry points found#4543
Manvi2402 wants to merge 2 commits intoopen-telemetry:mainfrom
Manvi2402:warn-missing-configurator-distro

Conversation

@Manvi2402
Copy link
Copy Markdown
Contributor

@Manvi2402 Manvi2402 commented May 7, 2026

Description

When opentelemetry-distro is not installed, opentelemetry-instrument
fails silently without any warning or error message. This makes it very
difficult to debug.

This PR adds a warning log message when no opentelemetry_configurator
entry points are found, clearly telling the user to install
opentelemetry-distro.

Fixes open-telemetry/opentelemetry-python#5180

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Updated existing test test_load_configurators_no_ep to assert
    that warning is logged when no entry points are found.

Run tests with:
pytest opentelemetry-instrumentation/tests/auto_instrumentation/test_load.py -v

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@Manvi2402 Manvi2402 requested a review from a team as a code owner May 7, 2026 06:11
@Manvi2402 Manvi2402 force-pushed the warn-missing-configurator-distro branch from 737789a to 5da3048 Compare May 7, 2026 06:14

def _load_distro() -> BaseDistro:
distro_name = environ.get(OTEL_PYTHON_DISTRO, None)
all_distros = list(entry_points(group="opentelemetry_distro"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need this, this is the case where DefaultDistro is return at the end of the function

def _load_configurators():
configurator_name = environ.get(OTEL_PYTHON_CONFIGURATOR, None)
configured = None
all_configurators = list(entry_points(group="opentelemetry_configurator"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this is the path where configured is None at the end of the loop below

@github-project-automation github-project-automation Bot moved this to Reviewed PRs that need fixes in Python PR digest May 7, 2026
@Manvi2402
Copy link
Copy Markdown
Contributor Author

Hi @xrmx , thanks for the review!

  1. Removed all_distros list from _load_distro() as suggested.
  2. Replaced all_configurators list check with configured is None
    check after the loop in _load_configurators().

Please review the updated changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

opentelemetry-instrument fails very silently if no configurator is available

2 participants