forked from phoenix/litellm-mirror
Merge pull request #2984 from Dev-Khant/slack-msg-truncation
truncate long slack msg
This commit is contained in:
commit
e01e9fd764
1 changed files with 3 additions and 1 deletions
|
@ -20,6 +20,7 @@ import datetime, time
|
|||
import tiktoken
|
||||
import uuid
|
||||
import aiohttp
|
||||
import textwrap
|
||||
import logging
|
||||
import asyncio, httpx, inspect
|
||||
from inspect import iscoroutine
|
||||
|
@ -6547,8 +6548,9 @@ def handle_failure(exception, traceback_exception, start_time, end_time, args, k
|
|||
for detail in additional_details:
|
||||
slack_msg += f"{detail}: {additional_details[detail]}\n"
|
||||
slack_msg += f"Traceback: {traceback_exception}"
|
||||
truncated_slack_msg = textwrap.shorten(slack_msg, width=512, placeholder="...")
|
||||
slack_app.client.chat_postMessage(
|
||||
channel=alerts_channel, text=slack_msg
|
||||
channel=alerts_channel, text=truncated_slack_msg
|
||||
)
|
||||
elif callback == "sentry":
|
||||
capture_exception(exception)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue