Being a Python guy I’m doing most of my web development these days using CherryPy. If you are not familiar it’s a  Python web framework that to me strikes just the right balance of simplicity and power.

Behind the scenes at Key Ring we also have a large Rails footprint. For the past year we’ve been using New Relic to monitor application performance up and down the stack. When it comes to monitoring and troubleshooting a web app I can’t recommend these guys enough. They’re constantly making improvements, adding features, and the product has become indispensable to our team.

So I just finished building some data services in CherryPy and was psyched to hook up the New Relic agent to this app. The docs on the New Relic site are pretty thorough but I wasn’t able to piece together how to hook the agent into the CherryPy app. Also, could’t find anything on the web. Through trial and error I was able to get it working…. it’s actually extremely easy if you just follow these steps.


1. Download the latest Python agent. Unpack.

2. Run the setup

3. Generate a New Relic agent config file using your API key.

4. Change your app name in the New Relic config. There are some other logging bells and whistles which are all self-explanatory

5.  Add these 2 lines to your sites startup script. Make sure you do it early in the script before any database calls, etc…


And that’s it. In the next minute or so you’ll begin to see your stats streaming into your New Relic dashboard.