litellm - ✅(Solved) Fix [Feature]: Add prometheus metrics for orgs like we have for teams [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24249Fetched 2026-04-08 01:09:04
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2closed ×1cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #24449: Feat/prometheus org budget metrics

Description (problem / solution / changelog)

Relevant issues

Resolves #24249

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

🆕 New Feature

Changes

Add organization budget Prometheus metrics

Adds three new gauge metrics tracking org-level budget:

  • litellm_remaining_org_budget_metric
  • litellm_org_max_budget_metric
  • litellm_org_budget_remaining_hours_metric

Metrics are pre-populated at proxy startup and updated after every request (success and failure). Org data is fetched via the existing get_org_object cache helper to avoid per-request DB hits. Labels: org_id, org_alias.

Changed files

  • litellm/integrations/prometheus.py (modified, +196/-2)
  • litellm/types/integrations/prometheus.py (modified, +26/-0)
  • tests/test_litellm/integrations/test_prometheus_user_team_metrics.py (modified, +191/-1)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

The Feature

<img width="717" height="234" alt="Image" src="https://github.com/user-attachments/assets/69258a7f-97e7-4cca-9a50-037695afe3a3" />

Motivation, pitch

Helps with alerting systems.

What part of LiteLLM is this about?

Proxy

LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?

No

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To address the issue, we will implement a proxy alerting system.

  • Set up a proxy server to handle incoming requests
  • Configure the proxy server to send alerts based on predefined conditions
  • Implement a notification system to handle alerts

Example Code

import requests

# Set up proxy server
proxy_url = "http://proxy.example.com"
alert_condition = "error"

# Define a function to send alerts
def send_alert(message):
    # Send alert using notification system
    notification_url = "https://notification.example.com"
    response = requests.post(notification_url, json={"message": message})
    if response.status_code == 200:
        print("Alert sent successfully")
    else:
        print("Failed to send alert")

# Define a function to handle incoming requests
def handle_request(request):
    # Check if the request meets the alert condition
    if alert_condition in request.text:
        # Send an alert
        send_alert("Error detected in request")
    # Forward the request to the destination server
    destination_url = "https://destination.example.com"
    response = requests.request(request.method, destination_url, headers=request.headers, data=request.data)
    return response

Verification

To verify that the fix worked, test the proxy alerting system by sending a request that meets the alert condition. Check that an alert is sent successfully and that the request is forwarded to the destination server.

Extra Tips

  • Make sure to configure the proxy server and notification system correctly
  • Test the alerting system thoroughly to ensure it works as expected
  • Consider implementing additional features, such as alert filtering and notification customization.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Feature]: Add prometheus metrics for orgs like we have for teams [1 pull requests, 1 participants]