Skip to content

Commit 34ae8ec

Browse files
Fix prometheus registry (#613)
* Use registry passed to `setup_prometheus_sensors` to generate metric view * refactor: import `web` once
1 parent 5330c45 commit 34ae8ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

faust/sensors/prometheus.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from aiohttp.web import Response
77

8-
from faust import web, web as _web
8+
from faust import web
99
from faust.exceptions import ImproperlyConfigured
1010
from faust.types import (
1111
TP,
@@ -68,12 +68,12 @@ def setup_prometheus_sensors(
6868
app.monitor = PrometheusMonitor(metrics=faust_metrics)
6969

7070
@app.page(pattern)
71-
async def metrics_handler(self: _web.View, request: _web.Request) -> _web.Response:
71+
async def metrics_handler(self: web.View, request: web.Request) -> web.Response:
7272
headers = {"Content-Type": CONTENT_TYPE_LATEST}
7373

7474
return cast(
75-
_web.Response,
76-
Response(body=generate_latest(REGISTRY), headers=headers, status=200),
75+
web.Response,
76+
Response(body=generate_latest(registry), headers=headers, status=200),
7777
)
7878

7979

0 commit comments

Comments
 (0)