mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
support using "callbacks" for prometheus
This commit is contained in:
parent
3bf6589fab
commit
e253c100f4
3 changed files with 70 additions and 0 deletions
|
@ -228,6 +228,16 @@ def initialize_callbacks_on_proxy(
|
|||
litellm.callbacks.extend(imported_list)
|
||||
else:
|
||||
litellm.callbacks = imported_list # type: ignore
|
||||
|
||||
if "prometheus" in value:
|
||||
from litellm.proxy.proxy_server import app
|
||||
|
||||
verbose_proxy_logger.debug("Starting Prometheus Metrics on /metrics")
|
||||
from prometheus_client import make_asgi_app
|
||||
|
||||
# Add prometheus asgi middleware to route /metrics requests
|
||||
metrics_app = make_asgi_app()
|
||||
app.mount("/metrics", metrics_app)
|
||||
else:
|
||||
litellm.callbacks = [
|
||||
get_instance_fn(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue