mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(fastapi): fix prometheus parsing of HTTPStatus
This wasn't actually casting to int. We shouldn't be providing HTTPStatus.CONSTANTS directly anyway, but, in case we do, we now just convert the status to an int before converting it to a string. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
9aa8decf40
commit
16e6fa2cdd
2 changed files with 2 additions and 2 deletions
|
@ -79,7 +79,7 @@ def http_requests_total() -> Callable[[Info], None]:
|
|||
|
||||
method = scope.get("method")
|
||||
path = get_matching_route_path(base_scope, scope.get("router").routes)
|
||||
status = str(info.response.status_code)[:1] + "xx"
|
||||
status = str(int(info.response.status_code))[:1] + "xx"
|
||||
|
||||
metric.labels(method=method, path=path, status=status).inc()
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ async def package_base(request: Request, name: str) -> Response:
|
|||
# If this is not a split package, redirect to /packages/{name}.
|
||||
if pkgbase.packages.count() == 1:
|
||||
return RedirectResponse(f"/packages/{name}",
|
||||
status_code=HTTPStatus.SEE_OTHER)
|
||||
status_code=int(HTTPStatus.SEE_OTHER))
|
||||
|
||||
# Add our base information.
|
||||
context = await make_single_context(request, pkgbase)
|
||||
|
|
Loading…
Add table
Reference in a new issue