Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
4dc8026d
Unverified
Commit
4dc8026d
authored
May 01, 2024
by
Robert Shaw
Committed by
GitHub
May 01, 2024
Browse files
[Bugfix] Fix 307 Redirect for `/metrics` (#4523)
parent
a88bb9b0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
vllm/engine/metrics.py
vllm/engine/metrics.py
+1
-1
vllm/entrypoints/openai/api_server.py
vllm/entrypoints/openai/api_server.py
+6
-2
No files found.
vllm/engine/metrics.py
View file @
4dc8026d
...
@@ -119,7 +119,7 @@ class Metrics:
...
@@ -119,7 +119,7 @@ class Metrics:
buckets
=
[
1
,
2
,
5
,
10
,
20
],
buckets
=
[
1
,
2
,
5
,
10
,
20
],
)
)
self
.
counter_request_success
=
Counter
(
self
.
counter_request_success
=
Counter
(
name
=
"vllm:request_success"
,
name
=
"vllm:request_success
_total
"
,
documentation
=
"Count of successfully processed requests."
,
documentation
=
"Count of successfully processed requests."
,
labelnames
=
labelnames
+
[
Metrics
.
labelname_finish_reason
])
labelnames
=
labelnames
+
[
Metrics
.
labelname_finish_reason
])
...
...
vllm/entrypoints/openai/api_server.py
View file @
4dc8026d
...
@@ -2,6 +2,7 @@ import asyncio
...
@@ -2,6 +2,7 @@ import asyncio
import
importlib
import
importlib
import
inspect
import
inspect
import
os
import
os
import
re
from
contextlib
import
asynccontextmanager
from
contextlib
import
asynccontextmanager
from
http
import
HTTPStatus
from
http
import
HTTPStatus
...
@@ -12,6 +13,7 @@ from fastapi.exceptions import RequestValidationError
...
@@ -12,6 +13,7 @@ from fastapi.exceptions import RequestValidationError
from
fastapi.middleware.cors
import
CORSMiddleware
from
fastapi.middleware.cors
import
CORSMiddleware
from
fastapi.responses
import
JSONResponse
,
Response
,
StreamingResponse
from
fastapi.responses
import
JSONResponse
,
Response
,
StreamingResponse
from
prometheus_client
import
make_asgi_app
from
prometheus_client
import
make_asgi_app
from
starlette.routing
import
Mount
import
vllm
import
vllm
from
vllm.engine.arg_utils
import
AsyncEngineArgs
from
vllm.engine.arg_utils
import
AsyncEngineArgs
...
@@ -55,8 +57,10 @@ def parse_args():
...
@@ -55,8 +57,10 @@ def parse_args():
# Add prometheus asgi middleware to route /metrics requests
# Add prometheus asgi middleware to route /metrics requests
metrics_app
=
make_asgi_app
()
route
=
Mount
(
"/metrics"
,
make_asgi_app
())
app
.
mount
(
"/metrics"
,
metrics_app
)
# Workaround for 307 Redirect for /metrics
route
.
path_regex
=
re
.
compile
(
'^/metrics(?P<path>.*)$'
)
app
.
routes
.
append
(
route
)
@
app
.
exception_handler
(
RequestValidationError
)
@
app
.
exception_handler
(
RequestValidationError
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment