forked from phoenix/litellm-mirror
SpendLogsPayload- track user ip
This commit is contained in:
parent
626c630eaf
commit
b99ffcf8ae
4 changed files with 8 additions and 1 deletions
|
@ -1319,6 +1319,7 @@ class LiteLLM_SpendLogs(LiteLLMBase):
|
|||
cache_hit: Optional[str] = "False"
|
||||
cache_key: Optional[str] = None
|
||||
request_tags: Optional[Json] = None
|
||||
requester_ip_address: Optional[str] = None
|
||||
|
||||
|
||||
class LiteLLM_ErrorLogs(LiteLLMBase):
|
||||
|
@ -1510,6 +1511,7 @@ class SpendLogsMetadata(TypedDict):
|
|||
spend_logs_metadata: Optional[
|
||||
dict
|
||||
] # special param to log k,v pairs to spendlogs for a call
|
||||
requester_ip_address: Optional[str]
|
||||
|
||||
|
||||
class SpendLogsPayload(TypedDict):
|
||||
|
@ -1534,6 +1536,7 @@ class SpendLogsPayload(TypedDict):
|
|||
request_tags: str # json str
|
||||
team_id: Optional[str]
|
||||
end_user: Optional[str]
|
||||
requester_ip_address: Optional[str]
|
||||
|
||||
|
||||
class SpanAttributes(str, enum.Enum):
|
||||
|
|
|
@ -191,6 +191,7 @@ model LiteLLM_SpendLogs {
|
|||
request_tags Json @default("[]")
|
||||
team_id String?
|
||||
end_user String?
|
||||
requester_ip_address String?
|
||||
}
|
||||
|
||||
// View spend, model, api_key per request
|
||||
|
|
|
@ -55,6 +55,7 @@ def get_logging_payload(
|
|||
user_api_key_user_id=None,
|
||||
user_api_key_team_alias=None,
|
||||
spend_logs_metadata=None,
|
||||
requester_ip_address=None,
|
||||
)
|
||||
if isinstance(metadata, dict):
|
||||
verbose_proxy_logger.debug(
|
||||
|
@ -109,6 +110,7 @@ def get_logging_payload(
|
|||
api_base=litellm_params.get("api_base", ""),
|
||||
model_group=_model_group,
|
||||
model_id=_model_id,
|
||||
requester_ip_address=clean_metadata.get("requester_ip_address", None),
|
||||
)
|
||||
|
||||
verbose_proxy_logger.debug(
|
||||
|
|
|
@ -191,6 +191,7 @@ model LiteLLM_SpendLogs {
|
|||
request_tags Json @default("[]")
|
||||
team_id String?
|
||||
end_user String?
|
||||
requester_ip_address String?
|
||||
}
|
||||
|
||||
// View spend, model, api_key per request
|
||||
|
@ -256,4 +257,4 @@ model LiteLLM_AuditLog {
|
|||
object_id String // id of the object being audited. This can be the key id, team id, user id, model id
|
||||
before_value Json? // value of the row
|
||||
updated_values Json? // value of the row after change
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue