mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-19 00:01:29 +00:00
fix(logging): avoid rebinding callback constructor args
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
d3bf96c049
commit
10d7cdd0a8
1 changed files with 11 additions and 9 deletions
|
|
@ -4300,7 +4300,9 @@ def _construct_custom_logger_compatible_class(
|
|||
custom_logger_init_args: dict | None = None, # mutable-ok: callback constructor API
|
||||
) -> CustomLogger | None:
|
||||
try:
|
||||
custom_logger_init_args = custom_logger_init_args or {}
|
||||
resolved_custom_logger_init_args: Final[dict] = ( # mutable-ok: callback constructor API
|
||||
custom_logger_init_args or {}
|
||||
)
|
||||
if logging_integration == "agentops": # Add AgentOps initialization
|
||||
_v2 = _maybe_construct_otel_v2("agentops", _in_memory_loggers)
|
||||
if _v2 is not None:
|
||||
|
|
@ -4390,10 +4392,10 @@ def _construct_custom_logger_compatible_class(
|
|||
return _prometheus_logger
|
||||
elif logging_integration == "datadog":
|
||||
# Check if team-scoped credentials are provided
|
||||
_dd_api_key: Final = custom_logger_init_args.get("dd_api_key")
|
||||
_dd_site: Final = custom_logger_init_args.get("dd_site")
|
||||
_dd_agent_host: Final = custom_logger_init_args.get("dd_agent_host")
|
||||
_dd_agent_port: Final = custom_logger_init_args.get("dd_agent_port")
|
||||
_dd_api_key: Final = resolved_custom_logger_init_args.get("dd_api_key")
|
||||
_dd_site: Final = resolved_custom_logger_init_args.get("dd_site")
|
||||
_dd_agent_host: Final = resolved_custom_logger_init_args.get("dd_agent_host")
|
||||
_dd_agent_port: Final = resolved_custom_logger_init_args.get("dd_agent_port")
|
||||
|
||||
if _dd_api_key or _dd_site or _dd_agent_host:
|
||||
# Team-scoped credentials: use DynamicLoggingCache for per-credential isolation
|
||||
|
|
@ -4402,7 +4404,7 @@ def _construct_custom_logger_compatible_class(
|
|||
)
|
||||
|
||||
return DataDogHandler.get_datadog_logger_for_request(
|
||||
standard_callback_dynamic_params=custom_logger_init_args,
|
||||
standard_callback_dynamic_params=resolved_custom_logger_init_args,
|
||||
in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,
|
||||
)
|
||||
|
||||
|
|
@ -4795,7 +4797,7 @@ def _construct_custom_logger_compatible_class(
|
|||
for callback in _in_memory_loggers:
|
||||
if isinstance(callback, PagerDutyAlerting):
|
||||
return callback
|
||||
pagerduty_logger: Final = _PAGERDUTY_ALERTING_FACTORY(**custom_logger_init_args)
|
||||
pagerduty_logger: Final = _PAGERDUTY_ALERTING_FACTORY(**resolved_custom_logger_init_args)
|
||||
_in_memory_loggers.append(pagerduty_logger)
|
||||
return pagerduty_logger
|
||||
elif logging_integration == "anthropic_cache_control_hook":
|
||||
|
|
@ -4902,7 +4904,7 @@ def _construct_custom_logger_compatible_class(
|
|||
_in_memory_loggers.append(gitlab_logger)
|
||||
return gitlab_logger
|
||||
elif logging_integration == "newrelic":
|
||||
if custom_logger_init_args.get("newrelic_api_key"):
|
||||
if resolved_custom_logger_init_args.get("newrelic_api_key"):
|
||||
# Team-scoped credentials: per-team METRICS logger, isolated per
|
||||
# credential set via DynamicLoggingCache. The trace logger for
|
||||
# this name stays on the global path below.
|
||||
|
|
@ -4911,7 +4913,7 @@ def _construct_custom_logger_compatible_class(
|
|||
)
|
||||
|
||||
return NewRelicHandler.get_newrelic_logger_for_request(
|
||||
standard_callback_dynamic_params=custom_logger_init_args,
|
||||
standard_callback_dynamic_params=resolved_custom_logger_init_args,
|
||||
in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue