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

Suggestion for making provider config optional #2

Open
wants to merge 17 commits into
base: issue_123
Choose a base branch
from

Conversation

c24t
Copy link

@c24t c24t commented Mar 13, 2020

Suggestion for making config and conftest files optional in open-telemetry#466.

This tries to load third party meter providers first, then falls back to the default SDK, then uses the one that ships with the API package. It does mean the API has some knowledge of the SDK package, but only its name.

I like this solution because it doesn't require any config for common use cases. This is similar to the ServiceLoader-based approach in java.

% python -c "from opentelemetry import metrics; print(metrics.get_meter_provider().get_meter(__name__))"
<opentelemetry.sdk.metrics.Meter object at 0x108baa9d0>

% pip uninstall -y opentelemetry-sdk Found existing installation: opentelemetry-sdk 0.5.dev0
Uninstalling opentelemetry-sdk-0.5.dev0:
  Successfully uninstalled opentelemetry-sdk-0.5.dev0

% python -c "from opentelemetry import metrics; print(metrics.get_meter_provider().get_meter(__name__))"
<opentelemetry.metrics.DefaultMeter object at 0x1066b7810>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants