Skip to content

Commit 6cf0568

Browse files
authored
Fixed prometheus collectors. (#617)
1 parent 784fa88 commit 6cf0568

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

taskiq/middlewares/prometheus_middleware.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,17 @@ def startup(self) -> None:
8484
This function starts prometheus server.
8585
It starts it only in case if it's a worker process.
8686
"""
87-
from prometheus_client import ( # noqa: PLC0415
88-
CollectorRegistry,
89-
start_http_server,
90-
)
87+
from prometheus_client import REGISTRY, start_http_server # noqa: PLC0415
9188
from prometheus_client.multiprocess import ( # noqa: PLC0415
9289
MultiProcessCollector,
9390
)
9491

9592
if self.broker.is_worker_process:
9693
try:
97-
registry = CollectorRegistry()
98-
MultiProcessCollector(registry)
94+
MultiProcessCollector(REGISTRY)
9995
start_http_server(
10096
port=self.server_port,
10197
addr=self.server_addr,
102-
registry=registry,
10398
)
10499
except OSError as exc:
105100
logger.debug("Cannot start prometheus server: %s", exc)

0 commit comments

Comments
 (0)