diff --git a/docs/my-website/docs/proxy/alerting.md b/docs/my-website/docs/proxy/alerting.md index 095d40a17bd..19f3c88a657 100644 --- a/docs/my-website/docs/proxy/alerting.md +++ b/docs/my-website/docs/proxy/alerting.md @@ -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 diff --git a/litellm/integrations/slack_alerting.py b/litellm/integrations/slack_alerting.py index 7252967d9c0..04e5a4d1b5a 100644 --- a/litellm/integrations/slack_alerting.py +++ b/litellm/integrations/slack_alerting.py @@ -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