Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Dec 4, 2023
1 parent dfe0dfe commit ba752b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions serve/mlc_serve/api/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,19 @@ def _get_sampling_params(request: ChatCompletionRequest) -> SamplingParams:

@router.get("/metrics")
def metrics():
# See https://prometheus.github.io/client_python/multiprocess/ for why we need this.
if "PROMETHEUS_MULTIPROC_DIR" in os.environ:
from prometheus_client import (
CollectorRegistry,
generate_latest,
multiprocess,
)
from starlette.responses import Response

registry = CollectorRegistry()
multiprocess.MultiProcessCollector(registry)

from starlette.responses import Response
resp = Response(content=generate_latest(registry))
return resp
return Response(content=generate_latest(registry))
else:
return {}

Expand Down

0 comments on commit ba752b2

Please sign in to comment.