Skip to content
This repository was archived by the owner on Oct 16, 2023. It is now read-only.

Add prometheus endpoint for opt_server.py #149

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/opt/opt_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import Optional
from executor import Executor, QueueFullError
from cache import ListCache, MissCacheError
from prometheus_fastapi_instrumentator import Instrumentator


class GenerationTaskReq(BaseModel):
Expand Down Expand Up @@ -118,6 +119,10 @@ def launch_engine(model_class,
executor.start()

global server

# Expose prometheus metrics
Instrumentator().instrument(app).expose(app)

config = uvicorn.Config(app, host=server_host, port=server_port,
log_level=log_level, timeout_keep_alive=timeout_keep_alive)
server = uvicorn.Server(config=config)
Expand Down