Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_label_set(self, labels: Dict[str, str]) -> "LabelSet":
"""Gets a `LabelSet` with the given labels.
Args:
labels: A dictionary representing label key to label value pairs.
Returns: A `LabelSet` object canonicalized using the given input.
"""
# pylint: disable=no-self-use
return DefaultLabelSet()
# Once https://github.com/python/mypy/issues/7092 is resolved,
# the following type definition should be replaced with
# from opentelemetry.util.loader import ImplementationFactory
ImplementationFactory = Callable[[Type[Meter]], Optional[Meter]]
_METER = None
_METER_FACTORY = None
def meter() -> Meter:
"""Gets the current global :class:`~.Meter` object.
If there isn't one set yet, a default will be loaded.
"""
global _METER, _METER_FACTORY # pylint:disable=global-statement
if _METER is None:
# pylint:disable=protected-access
_METER = loader._load_impl(Meter, _METER_FACTORY)
del _METER_FACTORY
def meter() -> Meter:
"""Gets the current global :class:`~.Meter` object.
If there isn't one set yet, a default will be loaded.
"""
global _METER, _METER_FACTORY # pylint:disable=global-statement
if _METER is None:
# pylint:disable=protected-access
_METER = loader._load_impl(Meter, _METER_FACTORY)
del _METER_FACTORY
return _METER