diff --git a/litellm/integrations/otel/plumbing/providers.py b/litellm/integrations/otel/plumbing/providers.py index 81b00f788ee..d11133831c7 100644 --- a/litellm/integrations/otel/plumbing/providers.py +++ b/litellm/integrations/otel/plumbing/providers.py @@ -206,7 +206,7 @@ def build_metric_reader(config: OpenTelemetryV2Config) -> "MetricReader": ``console`` (and any unrecognized kind) exports to the console; ``otlp_http`` and ``otlp_grpc`` export over OTLP with the configured endpoint/headers. The - reader exports on a 5s period, matching v1. + reader uses the OpenTelemetry SDK's standard ``OTEL_METRIC_EXPORT_INTERVAL`` setting. Histograms keep the SDK's default cumulative temporality. Prometheus-backed OTLP receivers (Grafana Cloud / Mimir, and the Prometheus OTLP endpoint) @@ -248,7 +248,7 @@ def build_metric_reader(config: OpenTelemetryV2Config) -> "MetricReader": else: exporter = ConsoleMetricExporter() - return PeriodicExportingMetricReader(exporter, export_interval_millis=5000) + return PeriodicExportingMetricReader(exporter) def _otlp_logs_endpoint(endpoint: str | None) -> str | None: diff --git a/tests/test_litellm/integrations/otel/test_otel_v2_components.py b/tests/test_litellm/integrations/otel/test_otel_v2_components.py index 115e385eda4..d4fe0b74348 100644 --- a/tests/test_litellm/integrations/otel/test_otel_v2_components.py +++ b/tests/test_litellm/integrations/otel/test_otel_v2_components.py @@ -532,6 +532,14 @@ def test_otlp_metric_exporter_uses_cumulative_histogram_temporality(): assert temporality[Histogram] is AggregationTemporality.CUMULATIVE +def test_metric_reader_honors_standard_export_interval(monkeypatch): + monkeypatch.setenv("OTEL_METRIC_EXPORT_INTERVAL", "12345") + + reader = providers.build_metric_reader(OpenTelemetryV2Config(exporter="console")) + + assert reader._export_interval_millis == 12345 + + def test_otlp_logs_endpoint_normalization(): norm = providers._otlp_logs_endpoint # A base endpoint gets the signal path appended (the common OTLP env shape).