Skip to content

Suggestion for making provider config optional#2

Open
c24t wants to merge 17 commits intoocelotl:issue_123from
c24t:ep-defaults-suggestion
Open

Suggestion for making provider config optional#2
c24t wants to merge 17 commits intoocelotl:issue_123from
c24t:ep-defaults-suggestion

Conversation

@c24t
Copy link
Copy Markdown

@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