mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
Merge pull request #3622 from msabramo/abramowi/customizable-slack-report-frequency
Add ability to customize slack report frequency
This commit is contained in:
commit
e9d379446d
2 changed files with 14 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# 🚨 Alerting
|
||||
|
||||
Get alerts for:
|
||||
|
||||
- Hanging LLM api calls
|
||||
- Failed LLM api calls
|
||||
- Slow LLM api calls
|
||||
|
|
@ -10,6 +11,12 @@ Get alerts for:
|
|||
- Spend Reports - Weekly & Monthly spend per Team, Tag
|
||||
- Failed db read/writes
|
||||
|
||||
As a bonus, you can also get "daily reports" posted to your slack channel.
|
||||
These reports contain key metrics like:
|
||||
|
||||
- Top 5 deployments with most failed requests
|
||||
- Top 5 slowest deployments
|
||||
|
||||
## Quick Start
|
||||
|
||||
Set up a slack alert channel to receive alerts from proxy.
|
||||
|
|
@ -21,7 +28,8 @@ Get a slack webhook url from https://api.slack.com/messaging/webhooks
|
|||
|
||||
### Step 2: Update config.yaml
|
||||
|
||||
Let's save a bad key to our proxy
|
||||
- Set `SLACK_WEBHOOK_URL` in your proxy env to enable Slack alerts.
|
||||
- Just for testing purposes, let's save a bad key to our proxy.
|
||||
|
||||
```yaml
|
||||
model_list:
|
||||
|
|
@ -34,13 +42,11 @@ general_settings:
|
|||
alerting: ["slack"]
|
||||
alerting_threshold: 300 # sends alerts if requests hang for 5min+ and responses take 5min+
|
||||
|
||||
environment_variables:
|
||||
SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/<>/<>/<>"
|
||||
SLACK_DAILY_REPORT_FREQUENCY: "86400" # 24 hours; Optional: defaults to 12 hours
|
||||
```
|
||||
|
||||
Set `SLACK_WEBHOOK_URL` in your proxy env
|
||||
|
||||
```shell
|
||||
SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/<>/<>/<>"
|
||||
```
|
||||
|
||||
### Step 3: Start proxy
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ class LiteLLMBase(BaseModel):
|
|||
|
||||
|
||||
class SlackAlertingArgs(LiteLLMBase):
|
||||
daily_report_frequency: int = 12 * 60 * 60 # 12 hours
|
||||
default_daily_report_frequency: int = 12 * 60 * 60 # 12 hours
|
||||
daily_report_frequency: int = int(os.getenv("SLACK_DAILY_REPORT_FREQUENCY", default_daily_report_frequency))
|
||||
report_check_interval: int = 5 * 60 # 5 minutes
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue