mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
fix(proxy): strip callback string before custom-logger registration
_add_custom_logger_callback_to_specific_event skips both registration and the string removal inside it when an instance already exists from an earlier registration, leaving the config string behind in litellm.success_callback. Remove the string explicitly in the config path so the duplicate check can never strand it.
This commit is contained in:
parent
2bafe2c978
commit
3a210c1b47
1 changed files with 13 additions and 2 deletions
|
|
@ -5122,7 +5122,14 @@ class ProxyConfig:
|
|||
# these are litellm callbacks - "langfuse", "sentry", "wandb"
|
||||
else:
|
||||
if callback in litellm._known_custom_logger_compatible_callbacks:
|
||||
_add_custom_logger_callback_to_specific_event(callback, "success")
|
||||
# drop the string first: _add_custom_logger_callback_to_specific_event
|
||||
# skips registration (and the string removal inside it) when an
|
||||
# instance already exists from an earlier registration
|
||||
if callback in litellm.success_callback:
|
||||
litellm.success_callback.remove(callback)
|
||||
_add_custom_logger_callback_to_specific_event( # pyright: ignore[reportPrivateUsage] # mirrors the DB-config registration path
|
||||
callback, "success"
|
||||
)
|
||||
else:
|
||||
litellm.logging_callback_manager.add_litellm_success_callback(callback)
|
||||
if "prometheus" in callback:
|
||||
|
|
@ -5152,7 +5159,11 @@ class ProxyConfig:
|
|||
# these are litellm callbacks - "langfuse", "sentry", "wandb"
|
||||
else:
|
||||
if callback in litellm._known_custom_logger_compatible_callbacks:
|
||||
_add_custom_logger_callback_to_specific_event(callback, "failure")
|
||||
if callback in litellm.failure_callback:
|
||||
litellm.failure_callback.remove(callback)
|
||||
_add_custom_logger_callback_to_specific_event( # pyright: ignore[reportPrivateUsage] # mirrors the DB-config registration path
|
||||
callback, "failure"
|
||||
)
|
||||
else:
|
||||
litellm.logging_callback_manager.add_litellm_failure_callback(callback)
|
||||
print( # noqa: T201
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue