mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-19 00:01:29 +00:00
fix(proxy): keep the usage api_key cap local to common_daily_activity to avoid a module-level import cycle
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
d6eac1f974
commit
733d6f1248
3 changed files with 4 additions and 6 deletions
|
|
@ -65,10 +65,6 @@ DEFAULT_MAX_RETRIES: Final = int(os.getenv("DEFAULT_MAX_RETRIES", 2))
|
|||
# Max records accepted in one POST /v1/callbacks/logs batch. Bounds the blast
|
||||
# radius: each record fans out to spend logs + every callback integration.
|
||||
MAX_CALLBACK_LOG_RECORDS: Final = 1000
|
||||
# Top keys by spend that get per-key rows in the aggregated usage response.
|
||||
# Six of its GROUPING SETS are keyed on api_key, so an uncapped result grows
|
||||
# with every distinct key and the prisma query engine OOMs buffering it.
|
||||
MAX_API_KEYS_IN_USAGE_BREAKDOWN: Final = 100
|
||||
DEFAULT_MAX_RECURSE_DEPTH: Final = int(os.getenv("DEFAULT_MAX_RECURSE_DEPTH", 100))
|
||||
DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER = int(os.getenv("DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER", 10))
|
||||
DEFAULT_FAILURE_THRESHOLD_PERCENT: Final = float(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from fastapi import HTTPException, status
|
|||
from typing_extensions import ReadOnly, TypedDict
|
||||
|
||||
from litellm._logging import verbose_proxy_logger
|
||||
from litellm.constants import MAX_API_KEYS_IN_USAGE_BREAKDOWN, PTU_SENTINEL_API_KEY
|
||||
from litellm.constants import PTU_SENTINEL_API_KEY
|
||||
from litellm.proxy._types import CommonProxyErrors
|
||||
from litellm.proxy.spend_tracking.key_metadata_recovery import (
|
||||
attach_user_emails,
|
||||
|
|
@ -52,6 +52,8 @@ _PRISMA_TO_PG_TABLE: Final[Mapping[str, str]] = {
|
|||
"litellm_dailytagspend": "LiteLLM_DailyTagSpend",
|
||||
}
|
||||
|
||||
MAX_API_KEYS_IN_USAGE_BREAKDOWN: Final = 100
|
||||
|
||||
|
||||
class DailySpendRecord(Protocol):
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import pytest
|
|||
from psycopg.rows import dict_row
|
||||
from pytest_postgresql import factories
|
||||
|
||||
from litellm.constants import MAX_API_KEYS_IN_USAGE_BREAKDOWN
|
||||
from litellm.proxy.management_endpoints.common_daily_activity import (
|
||||
MAX_API_KEYS_IN_USAGE_BREAKDOWN,
|
||||
_adjust_dates_for_timezone,
|
||||
_build_aggregated_sql_query,
|
||||
_build_entity_rollup_sql_query,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue