Skip to content

Commit

Permalink
Log request sizes (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunfeng-scale authored Dec 13, 2023
1 parent 74cc915 commit 5b64972
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions model-engine/model_engine_server/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class CustomMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request: Request, call_next):
try:
LoggerTagManager.set(LoggerTagKey.REQUEST_ID, str(uuid.uuid4()))
LoggerTagManager.set(LoggerTagKey.REQUEST_SIZE, request.headers.get("content-length"))
# we intentionally exclude healthcheck routes from the concurrency limiter
if request.url.path in healthcheck_routes:
return await call_next(request)
Expand Down
1 change: 1 addition & 0 deletions model-engine/model_engine_server/core/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class LoggerTagKey(str, Enum):
REQUEST_ID = "request_id"
TEAM_ID = "team_id"
USER_ID = "user_id"
REQUEST_SIZE = "request_size"


class LoggerTagManager:
Expand Down

0 comments on commit 5b64972

Please sign in to comment.