diff --git a/solarwinds_apm/apm_meter_manager.py b/solarwinds_apm/apm_meter_manager.py index 777874ab..0c71ee80 100644 --- a/solarwinds_apm/apm_meter_manager.py +++ b/solarwinds_apm/apm_meter_manager.py @@ -18,8 +18,6 @@ def __init__(self, **kwargs: int) -> None: # Gets the global default meter meter = metrics.get_meter("sw.apm.sampling.metrics") - logger.warning("APM doing create_histogram using meter %s, type %s", meter, type(meter)) - self.response_time = meter.create_histogram( name="trace.service.response_time", description="measures the duration of an inbound HTTP request", diff --git a/solarwinds_apm/configurator.py b/solarwinds_apm/configurator.py index d716e5ac..4e833bba 100644 --- a/solarwinds_apm/configurator.py +++ b/solarwinds_apm/configurator.py @@ -311,7 +311,6 @@ def _configure_metrics_exporter( metric_readers=metric_readers, ) metrics.set_meter_provider(provider) - logger.warning("APM set_meter_provider with %s, type %s", provider, type(provider)) def _configure_propagator(self) -> None: """Configure CompositePropagator with SolarWinds and other propagators, default or environment configured""" diff --git a/solarwinds_apm/otlp_metrics_processor.py b/solarwinds_apm/otlp_metrics_processor.py index 0470f256..b6460d7b 100644 --- a/solarwinds_apm/otlp_metrics_processor.py +++ b/solarwinds_apm/otlp_metrics_processor.py @@ -9,7 +9,6 @@ from typing import TYPE_CHECKING, Any, Tuple from opentelemetry.metrics import get_meter_provider -from opentelemetry.metrics._internal import _ProxyMeterProvider from opentelemetry.sdk.trace import SpanProcessor from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind, StatusCode @@ -101,38 +100,10 @@ def on_end(self, span: "ReadableSpan") -> None: # for SW-style trace export. This processor is for OTLP-style. # TODO: Cache txn_name for OTLP span export? - mp = get_meter_provider() - if isinstance(mp, _ProxyMeterProvider): - logger.warning("Attempting _ProxyMeterProvider._real_meter_provider") - mp = mp._real_meter_provider - if not mp: - logger.warning("There is no real_meter_provider. Cannot flush") - # try: - # meter_by_get = mp.get_meter("sw.apm.sampling.metrics") - # logger.warning("Tried get_meter by APM name, got %s type %s", meter_by_get, type(meter_by_get)) - # meters_by_attr = mp._meters() - # logger.warning("Meter by attr is %s", meters_by_attr) - - # if meter_by_get: - # try: - # logger.warning("Trying _real_meter, _instruments with meter_by_get") - # logger.warning("%s", meter_by_get._real_meter) - # logger.warning("%s", meter_by_get._instruments) - # except Exception as exc: - # logger.error("Got exception playing with meter_by_get: %s", exc) - # except Exception as exc: - # logger.error("Got exception trying to get_meter: %s", exc) - - return - if not hasattr(mp, "force_flush"): - logger.warning("No MeterProvider force_flush available at on_end. Cannot flush") - return - # Force flush metrics after every entry span via flush of all meters # including PeriodicExportingMetricReader - # get_meter_provider().force_flush() - logger.warning("Will force_flush MeterProvider at on_end") - mp.force_flush() + logger.debug("Performing MeterProvider force_flush of metrics") + get_meter_provider().force_flush() # TODO If needed for both inbound and otlp metrics, refactor def is_span_http(self, span: "ReadableSpan") -> bool: