mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Merge pull request #5059 from BerriAI/litelm_log_otel_args
OTEL - Log DB queries / functions on OTEL
This commit is contained in:
commit
da848696e3
4 changed files with 37 additions and 22 deletions
|
@ -26,18 +26,6 @@ model_list:
|
|||
model_info:
|
||||
mode: audio_speech
|
||||
|
||||
# For /fine_tuning/jobs endpoints
|
||||
finetune_settings:
|
||||
- custom_llm_provider: azure
|
||||
api_base: https://exampleopenaiendpoint-production.up.railway.app
|
||||
api_key: fake-key
|
||||
api_version: "2023-03-15-preview"
|
||||
- custom_llm_provider: openai
|
||||
api_key: os.environ/OPENAI_API_KEY
|
||||
- custom_llm_provider: "vertex_ai"
|
||||
vertex_project: "adroit-crow-413218"
|
||||
vertex_location: "us-central1"
|
||||
vertex_credentials: "/Users/ishaanjaffer/Downloads/adroit-crow-413218-a956eef1a2a8.json"
|
||||
|
||||
# for /files endpoints
|
||||
files_settings:
|
||||
|
@ -48,18 +36,11 @@ files_settings:
|
|||
- custom_llm_provider: openai
|
||||
api_key: os.environ/OPENAI_API_KEY
|
||||
|
||||
default_vertex_config:
|
||||
vertex_project: "adroit-crow-413218"
|
||||
vertex_location: "us-central1"
|
||||
vertex_credentials: "/Users/ishaanjaffer/Downloads/adroit-crow-413218-a956eef1a2a8.json"
|
||||
|
||||
|
||||
|
||||
general_settings:
|
||||
master_key: sk-1234
|
||||
|
||||
# Security controls
|
||||
max_request_size_mb: 100
|
||||
# google cloud run maximum repsonses size is 32MB
|
||||
max_response_size_mb: 10
|
||||
|
||||
litellm_settings:
|
||||
callbacks: ["otel"] # 👈 KEY CHANGE
|
|
@ -128,6 +128,11 @@ def log_to_opentelemetry(func):
|
|||
duration=0.0,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
event_metadata={
|
||||
"function_name": func.__name__,
|
||||
"function_kwargs": kwargs,
|
||||
"function_args": args,
|
||||
},
|
||||
)
|
||||
elif (
|
||||
# in litellm custom callbacks kwargs is passed as arg[0]
|
||||
|
@ -167,9 +172,15 @@ def log_to_opentelemetry(func):
|
|||
error=e,
|
||||
service=ServiceTypes.DB,
|
||||
call_type=func.__name__,
|
||||
parent_otel_span=kwargs["parent_otel_span"],
|
||||
duration=0.0,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
event_metadata={
|
||||
"function_name": func.__name__,
|
||||
"function_kwargs": kwargs,
|
||||
"function_args": args,
|
||||
},
|
||||
)
|
||||
raise e
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue