Skip to content

Commit

Permalink
Fix prometheus registry (#613)
Browse files Browse the repository at this point in the history
* Use registry passed to `setup_prometheus_sensors` to generate metric view

* refactor: import `web` once
  • Loading branch information
krzysieksulejczak authored Mar 4, 2024
1 parent 5330c45 commit 34ae8ec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions faust/sensors/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from aiohttp.web import Response

from faust import web, web as _web
from faust import web
from faust.exceptions import ImproperlyConfigured
from faust.types import (
TP,
Expand Down Expand Up @@ -68,12 +68,12 @@ def setup_prometheus_sensors(
app.monitor = PrometheusMonitor(metrics=faust_metrics)

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

return cast(
_web.Response,
Response(body=generate_latest(REGISTRY), headers=headers, status=200),
web.Response,
Response(body=generate_latest(registry), headers=headers, status=200),
)


Expand Down

0 comments on commit 34ae8ec

Please sign in to comment.