This is more a note-to-self and maybe to another confused soul – if you’re using New Relic (it seems to be really rather nice for web app monitoring) with uWSGI, by default uWSGI runs without the GIL. This means no threads and this means New Relic won’t report anything which leads to a confusing first try.
Specifically read the Best Practices notes for uWSGI around “–enable-threads”. You have to add “–enable-threads” if you’re using New Relic’s Python agent, this is documented on their Python Agent Integration docs for uWSGI but for me the clue was in their log (by default in /tmp/newrelic-python-agent.log if you enable it in newrelic.ini) which showed:
(3717/NR-Harvest-Thread) newrelic.core.agent DEBUG - Commencing harvest of all application data. (3717/NR-Harvest-Thread) newrelic.core.application DEBUG - Cannot perform a data harvest for '<appname>' as there is no active session. (3717/NR-Harvest-Thread) newrelic.core.agent DEBUG - Completed harvest of all application data in 0.00 seconds.
Once I’d added “–enable-threads” to uWSGI the logs looked a lot healthier, particularly:
(3292/NR-Harvest-Thread) newrelic.core.agent DEBUG - Commencing harvest of all application data. (3292/NR-Harvest-Thread) newrelic.core.application DEBUG - Commencing data harvest of '<appname>'. ...
(3292/NR-Harvest-Thread) newrelic.core.application DEBUG - Send profiling data for harvest of '<appname>'. (3292/NR-Harvest-Thread) newrelic.core.application DEBUG - Done sending data for harvest of '<appname>'.
Ian is a Chief Interim Data Scientist via his Mor Consulting. Sign-up for Data Science tutorials in London and to hear about his data science thoughts and jobs. He lives in London, is walked by his high energy Springer Spaniel and is a consumer of fine coffees.