January 13, 2015

Today I learned: newrelic-admin + venv, and hamartia

NewRelic + Virtualenv = Happy

The configuration docs clearly state:

The newrelic-admin program you run must be coming from the same Python installation or virtual environment as your application is using. You cannot mix programs/components from different Python installations. If this is done, the agent will not run correctly.)

it’s just when I read those back in November I didn’t understand well what Virtual Environments are in Python. Now I understand a little bit more, but it’s still feels of magic though I know it’s a SMOP behind the scenes.

Anyway, since we we’re using Supervisor we’d been starting up the processes like this:

command=/usr/local/bin/newrelic-admin run-program /usr/local/bin/awesomeo --model 5000

but since the program we’re running had its own virtual environment newrelic-admin would silently fail. Our program would start up just fine, but no monitoring data would be sent. And, frustratingly, no logging data would be written out – even with this in the INI:

log_file = /tmp/newrelic-agent.log
log_level = debug

Re-installing the program with:

$ source venv/bin/activate
$ pip install -I newrelic

or the Ansible play:

- name: lightbox API | force newrelic package into virtualenv
    sudo: False

will put it in your venv even if it’s installed locally.

New word: Hamartia

I ran across this word in a student essay today. It’s a neat word, and I hadn’t seen how Google treats such terms, which I think is both useful and informative:

Google defines Hamartia

…though the pronunciation icon didn’t work for me. (shrug)

Next: Today I remembered: psql exporting CSV
Previous: Today I learned: Bash and Ansible