mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
automatically log data to sentry if it's present in the environment variables
This commit is contained in:
parent
dc288474f3
commit
0ba0ca6896
4 changed files with 4 additions and 4 deletions
|
@ -440,7 +440,7 @@ def set_callbacks(callback_list):
|
|||
global sentry_sdk_instance, capture_exception, add_breadcrumb, posthog, slack_app, alerts_channel, heliconeLogger, aispendLogger, berrispendLogger, supabaseClient
|
||||
try:
|
||||
for callback in callback_list:
|
||||
if callback == "sentry":
|
||||
if callback == "sentry" or "SENTRY_API_URL" in os.environ:
|
||||
try:
|
||||
import sentry_sdk
|
||||
except ImportError:
|
||||
|
@ -449,7 +449,7 @@ def set_callbacks(callback_list):
|
|||
import sentry_sdk
|
||||
sentry_sdk_instance = sentry_sdk
|
||||
sentry_trace_rate = os.environ.get("SENTRY_API_TRACE_RATE") if "SENTRY_API_TRACE_RATE" in os.environ else "1.0"
|
||||
sentry_sdk_instance.init(dsn=os.environ.get("SENTRY_API_URL"), traces_sample_rate=float(os.environ.get("SENTRY_API_TRACE_RATE")))
|
||||
sentry_sdk_instance.init(dsn=os.environ.get("SENTRY_API_URL"), traces_sample_rate=float(sentry_trace_rate))
|
||||
capture_exception = sentry_sdk_instance.capture_exception
|
||||
add_breadcrumb = sentry_sdk_instance.add_breadcrumb
|
||||
elif callback == "posthog":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue