Merge pull request #2752 from BerriAI/litellm_grafana_metrics

[Fix + Docs] grafana / prometheus metrics
This commit is contained in:
Ishaan Jaff 2024-03-29 14:38:45 -07:00 committed by GitHub
commit e40a86d37a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 6 deletions

View file

@ -4,6 +4,8 @@ LiteLLM Exposes a `/metrics` endpoint for Prometheus to Poll
## Quick Start
If you're using the LiteLLM CLI with `litellm --config proxy_config.yaml` then you need to `pip install prometheus_client==0.20.0`. **This is already pre-installed on the litellm Docker image**
Add this to your proxy config.yaml
```yaml
model_list:
@ -34,6 +36,12 @@ curl --location 'http://0.0.0.0:4000/chat/completions' \
}'
```
View Metrics on `/metrics`, Visit `http://localhost:4000/metrics`
```shell
http://localhost:4000/metrics
# <proxy_base_url>/metrics
```
## Metrics Tracked

View file

@ -43,8 +43,5 @@ model_list:
model: openai/fake
api_key: fake-key
api_base: https://exampleopenaiendpoint-production.up.railway.app/
general_settings:
master_key: sk-1234
disable_spend_logs: true
disable_reset_budget: true
num_retries: 2
litellm_settings:
success_callback: ["prometheus"]

View file

@ -6235,7 +6235,8 @@ def set_callbacks(callback_list, function_id=None):
elif callback == "datadog":
dataDogLogger = DataDogLogger()
elif callback == "prometheus":
prometheusLogger = PrometheusLogger()
if prometheusLogger is None:
prometheusLogger = PrometheusLogger()
elif callback == "dynamodb":
dynamoLogger = DyanmoDBLogger()
elif callback == "s3":