Description
Hi, thanks for the awesome library. I am trying to add the PrometheusMiddleware
to an application, however, I am seeing some strange behavior when starting the worker(s).
taskiq
version: 0.8.2 (although I observed the same behavior on 0.8.1)
prometheus-client
version: 0.17.1 (although I observed the same behavior on 0.16.0)
I have defined my (redis) broker as follows:
broker = (
ListQueueBroker(url=REDIS_URL, queue_name="nebula_tasks")
.with_result_backend(redis_async_result)
.with_id_generator(task_id_generator)
.with_middlewares(
PrometheusMiddleware(server_addr="0.0.0.0", server_port=9000),
)
)
When I attempt to start my worker with default worker count I see the following trace (debug log enabled):
pipenv run taskiq worker --fs-discover --workers 2 --log-level DEBUG src.nebula.broker:broker
https://gist.github.com/nickdichev-firework/5b420be1d014f8fe925dcb63b771f5bd
When I attempt to start the worker with only one worker I see the following trace (debug log enabled):
pipenv run taskiq worker --fs-discover --workers 1 --log-level DEBUG src.nebula.broker:broker
https://gist.github.com/nickdichev-firework/36adf01a3ba11e22bf2c17766f61282b
When I remove the .with_middlewares
call with the broker I am able to start the worker (and process tasks) with two workers. However, what is interesting is that when I reduce it to one worker I see the same output as one worker with prometheus middleware enabled: FileNotFoundError
Any ideas? I am relatively new to python so kind of scratching my head at what else could be useful to debug, please let me know if you need any additional info! Thanks in advance!