Skip to content

Fixed prometheus multiprocessing registry#620

Open
FadingFog wants to merge 2 commits intotaskiq-python:masterfrom
FadingFog:bugfix/prom-registry
Open

Fixed prometheus multiprocessing registry#620
FadingFog wants to merge 2 commits intotaskiq-python:masterfrom
FadingFog:bugfix/prom-registry

Conversation

@FadingFog
Copy link
Copy Markdown

Replaces global prometheus REGISTRY with a new CollectorRegistry

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.79%. Comparing base (3f1d0d1) to head (7e30af2).

Files with missing lines Patch % Lines
taskiq/middlewares/prometheus_middleware.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #620      +/-   ##
==========================================
- Coverage   79.82%   79.79%   -0.04%     
==========================================
  Files          69       69              
  Lines        2528     2529       +1     
==========================================
  Hits         2018     2018              
- Misses        510      511       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@s3rius
Copy link
Copy Markdown
Member

s3rius commented May 8, 2026

First off, can you please run uv run pre-commit run -a to fix errors.

And, second thing. Can you please tell me how to run it properly? Because right now with the following code:

from taskiq_redis import ListQueueBroker

from taskiq.middlewares import PrometheusMiddleware

broker = ListQueueBroker("redis://localhost").with_middlewares(PrometheusMiddleware())

If you run it with

taskiq worker a:broker

Then localhost:9000 returns empty page.

@FadingFog
Copy link
Copy Markdown
Author

FadingFog commented May 8, 2026

First off, can you please run uv run pre-commit run -a to fix errors.

Fixed

Then localhost:9000 returns empty page.

It's happening because we create a new registry that doesn't have default python metrics, so there're no metrics at the time of worker startup. You can execute a task and then the metrics will be populated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants