Skip to content

Commit

Permalink
Add same fix for meter provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Jul 31, 2020
1 parent 15df8a0 commit 6993942
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion opentelemetry-api/src/opentelemetry/metrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ def set_meter_provider(meter_provider: MeterProvider) -> None:
global _METER_PROVIDER # pylint: disable=global-statement

if _METER_PROVIDER is not None:
logger.warning("Overriding current MeterProvider")
logger.warning("Overriding of current MeterProvider is not allowed")
return

_METER_PROVIDER = meter_provider

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-api/src/opentelemetry/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
from contextlib import contextmanager
from logging import getLogger

from opentelemetry.configuration import Configuration
from opentelemetry.trace.propagation import (
get_current_span,
set_span_in_context,
Expand Down Expand Up @@ -483,4 +482,5 @@ def get_tracer_provider() -> TracerProvider:
"get_tracer_provider",
"set_tracer_provider",
"set_span_in_context",
"Status",
]
4 changes: 2 additions & 2 deletions opentelemetry-api/tests/metrics/test_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def test_meter_provider_override_warning(self):
test.output,
[
(
"WARNING:opentelemetry.metrics:Overriding current "
"MeterProvider"
"WARNING:opentelemetry.metrics:Overriding of current "
"MeterProvider is not allowed"
)
],
)

0 comments on commit 6993942

Please sign in to comment.