Boosted_d16
Boosted_d16

Reputation: 14062

How to monitor celery logs in heroku

I want to monitor celery logs from an app in Heroku. I did some research and found a couple of repos that deploy a new heroku app which uses flower to monitor.

Problem: I followed those instructions and deployed a new app to heroku but I get this error message:

2023-08-03T11:09:17.312149+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/tornado/web.py", line 88, in <module>
2023-08-03T11:09:17.312150+00:00 app[web.1]:     from tornado import httputil
2023-08-03T11:09:17.312150+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/tornado/httputil.py", line 107, in <module>
2023-08-03T11:09:17.312151+00:00 app[web.1]:     class HTTPHeaders(collections.MutableMapping):
2023-08-03T11:09:17.312151+00:00 app[web.1]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-08-03T11:09:17.312151+00:00 app[web.1]: AttributeError: module 'collections' has no attribute 'MutableMapping'
2023-08-03T11:09:17.436513+00:00 heroku[web.1]: Process exited with status 1
2023-08-03T11:09:17.458578+00:00 heroku[web.1]: State changed from starting to crashed
2023-08-03T11:11:21.923503+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=celery-logger-4bd8f3ddc739.herokuapp.com request_id=50c72c4a-c22e-4801-8b4b-b7ec1eeaf3f2 fwd="86.14.252.189" dyno= connect= service= status=503 bytes= protocol=https
2023-08-03T11:11:23.115128+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=celery-logger-4bd8f3ddc739.herokuapp.com request_id=8c2c0a9a-3632-4b80-a10a-9ca568fd0fc9 fwd="86.14.252.189" dyno= connect= service= status=503 bytes= protocol=https

Not sure what I have done wrong? Please bear in mind that I'm not a software developer.

Upvotes: 0

Views: 90

Answers (1)

michjnich
michjnich

Reputation: 3385

It is not collections.MutableMapping, it is collections.abc.MutableMapping, your code is trying to access the class from the wrong path.

My guess is that the code you found is python 2.x, where I think MutableMapping was directly under collections. There were a lot of changes between python versions 2 and 3 though.

Current stable python version is 3.12 - look for more recent projects that support 3.7 and up and you'll have more luck.

Upvotes: 0

Related Questions