forked from phoenix/litellm-mirror
fix(proxy_server.py): expose disable_spend_logs
flag in config general settings
Writing each spend log adds +300ms latency https://github.com/BerriAI/litellm/issues/1714#issuecomment-1924727281
This commit is contained in:
parent
c840fecdeb
commit
7c74a0e6e2
2 changed files with 9 additions and 2 deletions
|
@ -605,6 +605,7 @@ general_settings:
|
||||||
"litellm_settings": {}, # ALL (https://github.com/BerriAI/litellm/blob/main/litellm/__init__.py)
|
"litellm_settings": {}, # ALL (https://github.com/BerriAI/litellm/blob/main/litellm/__init__.py)
|
||||||
"general_settings": {
|
"general_settings": {
|
||||||
"completion_model": "string",
|
"completion_model": "string",
|
||||||
|
"disable_spend_logs": "boolean", # turn off writing each transaction to the db
|
||||||
"key_management_system": "google_kms", # either google_kms or azure_kms
|
"key_management_system": "google_kms", # either google_kms or azure_kms
|
||||||
"master_key": "string",
|
"master_key": "string",
|
||||||
"database_url": "string",
|
"database_url": "string",
|
||||||
|
|
|
@ -281,6 +281,7 @@ proxy_budget_rescheduler_min_time = 597
|
||||||
proxy_budget_rescheduler_max_time = 605
|
proxy_budget_rescheduler_max_time = 605
|
||||||
proxy_batch_write_at = 60 # in seconds
|
proxy_batch_write_at = 60 # in seconds
|
||||||
litellm_master_key_hash = None
|
litellm_master_key_hash = None
|
||||||
|
disable_spend_logs = False
|
||||||
### INITIALIZE GLOBAL LOGGING OBJECT ###
|
### INITIALIZE GLOBAL LOGGING OBJECT ###
|
||||||
proxy_logging_obj = ProxyLogging(user_api_key_cache=user_api_key_cache)
|
proxy_logging_obj = ProxyLogging(user_api_key_cache=user_api_key_cache)
|
||||||
### REDIS QUEUE ###
|
### REDIS QUEUE ###
|
||||||
|
@ -1295,6 +1296,7 @@ async def update_database(
|
||||||
asyncio.create_task(_update_key_db())
|
asyncio.create_task(_update_key_db())
|
||||||
asyncio.create_task(_update_team_db())
|
asyncio.create_task(_update_team_db())
|
||||||
# asyncio.create_task(_insert_spend_log_to_db())
|
# asyncio.create_task(_insert_spend_log_to_db())
|
||||||
|
if disable_spend_logs == False:
|
||||||
await _insert_spend_log_to_db()
|
await _insert_spend_log_to_db()
|
||||||
|
|
||||||
verbose_proxy_logger.debug("Runs spend update on all tables")
|
verbose_proxy_logger.debug("Runs spend update on all tables")
|
||||||
|
@ -1614,7 +1616,7 @@ class ProxyConfig:
|
||||||
"""
|
"""
|
||||||
Load config values into proxy global state
|
Load config values into proxy global state
|
||||||
"""
|
"""
|
||||||
global master_key, user_config_file_path, otel_logging, user_custom_auth, user_custom_auth_path, user_custom_key_generate, use_background_health_checks, health_check_interval, use_queue, custom_db_client, proxy_budget_rescheduler_max_time, proxy_budget_rescheduler_min_time, ui_access_mode, litellm_master_key_hash, proxy_batch_write_at
|
global master_key, user_config_file_path, otel_logging, user_custom_auth, user_custom_auth_path, user_custom_key_generate, use_background_health_checks, health_check_interval, use_queue, custom_db_client, proxy_budget_rescheduler_max_time, proxy_budget_rescheduler_min_time, ui_access_mode, litellm_master_key_hash, proxy_batch_write_at, disable_spend_logs
|
||||||
|
|
||||||
# Load existing config
|
# Load existing config
|
||||||
config = await self.get_config(config_file_path=config_file_path)
|
config = await self.get_config(config_file_path=config_file_path)
|
||||||
|
@ -1982,6 +1984,10 @@ class ProxyConfig:
|
||||||
proxy_batch_write_at = general_settings.get(
|
proxy_batch_write_at = general_settings.get(
|
||||||
"proxy_batch_write_at", proxy_batch_write_at
|
"proxy_batch_write_at", proxy_batch_write_at
|
||||||
)
|
)
|
||||||
|
## DISABLE SPEND LOGS ## - gives a perf improvement
|
||||||
|
disable_spend_logs = general_settings.get(
|
||||||
|
"disable_spend_logs", disable_spend_logs
|
||||||
|
)
|
||||||
### BACKGROUND HEALTH CHECKS ###
|
### BACKGROUND HEALTH CHECKS ###
|
||||||
# Enable background health checks
|
# Enable background health checks
|
||||||
use_background_health_checks = general_settings.get(
|
use_background_health_checks = general_settings.get(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue