Merge pull request #5059 from BerriAI/litelm_log_otel_args

OTEL - Log DB queries / functions on OTEL
This commit is contained in:
Ishaan Jaff 2024-08-05 20:51:11 -07:00 committed by GitHub
commit da848696e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 22 deletions

View file

@ -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