Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d52918f

Browse files
author
Alex Boten
committed
more cleanup
1 parent f409768 commit d52918f

File tree

1 file changed

+1
-12
lines changed
  • exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus

1 file changed

+1
-12
lines changed

exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@
6969

7070
from prometheus_client import core
7171

72-
from opentelemetry.context import (
73-
_SUPPRESS_INSTRUMENTATION_KEY,
74-
attach,
75-
detach,
76-
set_value,
77-
)
7872
from opentelemetry.sdk._metrics.export import MetricReader
7973
from opentelemetry.sdk._metrics.point import Gauge, Histogram, Metric, Sum
8074

@@ -111,12 +105,7 @@ def __init__(self, prefix: str = "") -> None:
111105
def _receive_metrics(self, metrics: Iterable[Metric]) -> None:
112106
if metrics is None:
113107
return
114-
token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True))
115-
try:
116-
self._collector.add_metrics_data(metrics)
117-
except Exception as e: # pylint: disable=broad-except,invalid-name
118-
_logger.exception("Exception while exporting metrics %s", str(e))
119-
detach(token)
108+
self._collector.add_metrics_data(metrics)
120109

121110
def shutdown(self) -> bool:
122111
core.REGISTRY.unregister(self._collector)

0 commit comments

Comments
 (0)