UI (Keys Page) - Support cross filtering, filter by user id, filter by key hash (#10322)

* feat(filter.tsx): initial commit making filter component more generic - same style as user table filters

* refactor(all_keys_table.tsx): refactor to simplify update logic

* fix: partially revert changes - reduce scope of pr

* fix(filter_logic.tsx): fix filter update logic

* fix(all_keys_table.tsx): fix filtering + search logic

* refactor: cleanup unused params

* Revert "fix(all_keys_table.tsx): fix filtering + search logic"

This reverts commit 5fbc331970.

* feat(filter_logic.tsx): allow filter by user id

* fix(key_management_endpoints.py): support filtering `/key/list` by  key hash

Enables lookup by key hash on ui

* fix(key_list.tsx): fix update

* fix(key_management.py): fix linting error

* test: update testing

* fix(prometheus.py): fix key hash

* style(all_keys_table.tsx): style improvements

* test: fix test
This commit is contained in:
Krish Dholakia 2025-04-25 21:30:56 -07:00 committed by GitHub
parent 339351c579
commit c66c821f96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 292 additions and 350 deletions

View file

@ -1000,9 +1000,9 @@ class PrometheusLogger(CustomLogger):
):
try:
verbose_logger.debug("setting remaining tokens requests metric")
standard_logging_payload: Optional[StandardLoggingPayload] = (
request_kwargs.get("standard_logging_object")
)
standard_logging_payload: Optional[
StandardLoggingPayload
] = request_kwargs.get("standard_logging_object")
if standard_logging_payload is None:
return
@ -1453,6 +1453,7 @@ class PrometheusLogger(CustomLogger):
user_id=None,
team_id=None,
key_alias=None,
key_hash=None,
exclude_team_id=UI_SESSION_TOKEN_TEAM_ID,
return_full_object=True,
organization_id=None,
@ -1771,10 +1772,10 @@ class PrometheusLogger(CustomLogger):
from litellm.integrations.custom_logger import CustomLogger
from litellm.integrations.prometheus import PrometheusLogger
prometheus_loggers: List[CustomLogger] = (
litellm.logging_callback_manager.get_custom_loggers_for_type(
callback_type=PrometheusLogger
)
prometheus_loggers: List[
CustomLogger
] = litellm.logging_callback_manager.get_custom_loggers_for_type(
callback_type=PrometheusLogger
)
# we need to get the initialized prometheus logger instance(s) and call logger.initialize_remaining_budget_metrics() on them
verbose_logger.debug("found %s prometheus loggers", len(prometheus_loggers))