Skip to content

Commit

Permalink
Fix WorkerNameMetricsExporter to not export unless otel is enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggainey authored and mdellweg committed Oct 7, 2024
1 parent cd2b35f commit f5c439c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pulpcore/app/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""

import os
from django.core.wsgi import get_wsgi_application
from opentelemetry.instrumentation.wsgi import OpenTelemetryMiddleware
from opentelemetry.exporter.otlp.proto.http.metric_exporter import (
Expand Down Expand Up @@ -39,7 +40,8 @@ def export(self, metrics_data, timeout_millis=10_000, **kwargs):
provider = MeterProvider(metric_readers=[reader])

application = get_wsgi_application()
application = OpenTelemetryMiddleware(application, meter_provider=provider)
if os.getenv("PULP_OTEL_ENABLED", "").lower() == "true":
application = OpenTelemetryMiddleware(application, meter_provider=provider)

# Disabling Storage metrics until we find a solution to resource usage.
# https://github.com/pulp/pulpcore/issues/5468
Expand Down

0 comments on commit f5c439c

Please sign in to comment.