Repository navigation
fix(otel): honor metric export interval - #38055
Draft
daleselaji-dev wants to merge 1 commit into
Draft
daleselaji-dev wants to merge 1 commit into
daleselaji-dev wants to merge 1 commit into
Conversation
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merged
4 of 6 tasks
devin-ai-integration
Bot
changed the base branch from
litellm_internal_staging
to
main
September 23, 2026 14:57
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
LiteLLM's OpenTelemetry v2 metric reader hardcodes a 5-second export interval. This prevents deployments from using the standard
OTEL_METRIC_EXPORT_INTERVALenvironment variable and causes cumulative metric series to be re-exported more frequently than operators can control.Root Cause
build_metric_readerpassesexport_interval_millis=5000explicitly toPeriodicExportingMetricReader, overriding the OpenTelemetry SDK's environment-driven default.Solution
Let the OpenTelemetry SDK construct the reader with its standard interval resolution, including
OTEL_METRIC_EXPORT_INTERVAL.Changes
Testing
test_otel_v2_components.py: 59 passed.git diff --checkpassed.Anydiagnostics in the touched source at lines 229 and 251, outside this diff.Compatibility/Risk
The SDK default remains the effective fallback when the environment variable is absent. Existing deployments that relied on the previous 5-second value retain that behavior through the OpenTelemetry SDK default; deployments that set the standard variable can now control the interval.
Notes for Reviewer
The change is limited to the OTel v2 metric-reader constructor. The regression uses the console exporter and a mocked environment variable, so it does not contact an external collector.
Linked Issue
Fixes #38052