mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
Merge pull request #3244 from BerriAI/litellm_fix_linking_langfuse_slack_alerts
[Fix] Linking Langfuse Projects to Slack Alerts
This commit is contained in:
commit
e15ce79833
2 changed files with 16 additions and 1 deletions
|
|
@ -34,6 +34,14 @@ class LangFuseLogger:
|
|||
flush_interval=1, # flush interval in seconds
|
||||
)
|
||||
|
||||
# set the current langfuse project id in the environ
|
||||
# this is used by Alerting to link to the correct project
|
||||
try:
|
||||
project_id = self.Langfuse.client.projects.get().data[0].id
|
||||
except:
|
||||
project_id = None
|
||||
os.environ["LANGFUSE_PROJECT_ID"] = project_id
|
||||
|
||||
if os.getenv("UPSTREAM_LANGFUSE_SECRET_KEY") is not None:
|
||||
self.upstream_langfuse_secret_key = os.getenv(
|
||||
"UPSTREAM_LANGFUSE_SECRET_KEY"
|
||||
|
|
|
|||
|
|
@ -305,7 +305,14 @@ class ProxyLogging:
|
|||
_litellm_params["metadata"]["trace_id"] = trace_id
|
||||
|
||||
_langfuse_host = os.environ.get("LANGFUSE_HOST", "https://cloud.langfuse.com")
|
||||
request_info += f"\n🪢 Langfuse Trace: {_langfuse_host}/trace/{trace_id}"
|
||||
_langfuse_project_id = os.environ.get("LANGFUSE_PROJECT_ID")
|
||||
|
||||
# langfuse urls look like: https://us.cloud.langfuse.com/project/************/traces/litellm-alert-trace-ididi9dk-09292-************
|
||||
|
||||
_langfuse_url = (
|
||||
f"{_langfuse_host}/project/{_langfuse_project_id}/traces/{trace_id}"
|
||||
)
|
||||
request_info += f"\n🪢 Langfuse Trace: {_langfuse_url}"
|
||||
return request_info
|
||||
|
||||
async def response_taking_too_long(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue