mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
(Feat) - allow including dd-trace in litellm base image (#7587)
* introduce USE_DDTRACE=true * update dd tracer * update * bump dd trace * use og slim image * DD tracing * fix _init_dd_tracer
This commit is contained in:
parent
0b5c1392f7
commit
6125ba1e2b
9 changed files with 55 additions and 5 deletions
|
@ -535,7 +535,13 @@ async def proxy_startup_event(app: FastAPI):
|
|||
proxy_batch_write_at=proxy_batch_write_at,
|
||||
proxy_logging_obj=proxy_logging_obj,
|
||||
)
|
||||
## [Optional] Initialize dd tracer
|
||||
ProxyStartupEvent._init_dd_tracer()
|
||||
|
||||
# End of startup event
|
||||
yield
|
||||
|
||||
# Shutdown event
|
||||
await proxy_shutdown_event()
|
||||
|
||||
|
||||
|
@ -3218,6 +3224,19 @@ class ProxyStartupEvent:
|
|||
await prisma_client.health_check()
|
||||
return prisma_client
|
||||
|
||||
@classmethod
|
||||
def _init_dd_tracer(cls):
|
||||
"""
|
||||
Initialize dd tracer - if `USE_DDTRACE=true` in .env
|
||||
|
||||
DD tracer is used to trace Python applications.
|
||||
Doc: https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/python/
|
||||
"""
|
||||
if get_secret_bool("USE_DDTRACE", False) is True:
|
||||
import ddtrace
|
||||
|
||||
ddtrace.patch_all(logging=True)
|
||||
|
||||
|
||||
#### API ENDPOINTS ####
|
||||
@router.get(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue