Closed Bug 857057 Opened 13 years ago Closed 12 years ago

[basket] Add New Relic to celery workers

Categories

(Infrastructure & Operations Graveyard :: WebOps: Other, task)

All
Other
task
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pmac, Assigned: cliang)

Details

(Whiteboard: [kanban:https://kanbanize.com/ctrl_board/4/98] )

Attachments

(2 files)

Docs for this from NR are here: https://newrelic.com/docs/python/python-agent-and-celery I believe :jakem also sets an environment variable for the app name for the webapps, which in this case should match the name the webpp is using for that environment: basket-dev.allizom.org, basket.allizom.org, and basket.mozilla.org. We should take some time to test this in dev and stage before prod obviously. There's no rush, but it's important for monitoring the workers and improving performance and fault tolerance.
jakem: Here is the bug I mentioned today during our web ops call.
Flags: needinfo?(nmaul)
I poked at this a bit tonight... 2 main problems: 1) Our puppet configs don't make this easy right now. We generalized how a celery service gets set up, which is really nice for doing it quickly, but it doesn't include New Relic integration. Will need some modification. (For the record, I'm talking about webapp/manifests/genericrhel6/prod-celery.pp and webapp/manifests/genericrhel6/celery_service.pp, which ultimately rely on supervisord::service.) 2) I've tried it by hand (without puppet), and while I can make it work, I can't get it to obey any particular application name... it always comes in as "Python Application". This might be okay right now when it's only basket.mozilla.org in there, but this is no good as soon as any other app starts doing this... the jobs will become intermingled. Not to mention it's less convenient from a simple UX perspective. For anyone that comes along looking at this, here is the supervisord config file I was using to test with puppet disabled. It's stock, except for the "command" and "environment" lines. [program:celery-basket] command=/usr/bin/newrelic-admin run-program /usr/bin/python ./manage.py celeryd --loglevel=INFO -f /var/log/celeryd-basket.log -c 4 directory=/data/www/basket.mozilla.org/basket user=apache numprocs=1 stdout_logfile=/var/log/celery-basket-supervisor.log stderr_logfile=/var/log/celery-basket-supervisor.log autostart=true autorestart=true startsecs=10 environment=NEW_RELIC_CONFIG_FILE="/etc/newrelic/python.ini",NEW_RELIC_APP_NAME="basket.mozilla.org" ; Need to wait for currently executing tasks to finish at shutdown. ; Increase this if you have very long running tasks. stopwaitsecs = 60 priority = 999
Flags: needinfo?(nmaul)
Component: Server Operations: Web Operations → WebOps: Other
Product: mozilla.org → Infrastructure & Operations
I've done some work to get NewRelic reporting for celery under different application names; I've "pseudo-forked" celery::service to celery::service2. I've enabled this for basket-dev.allizom.org, but I don't know what I need to do in order to generate celery traffic in the basket dev environment. If someone can generate that traffic or tell me how to do so, I'd appreciate the opportunity to verify that I've set everything up correctly. =)
Flags: needinfo?(pmac)
Hi :cyliang Best way to generate work for the dev workers is to interact with the dev mozilla.org. For example, you could sign up for a newsletter at the following url: https://www-dev.allizom.org/en-US/newsletter/ I'm not sure why it would require a different app-name, but any data we can get would be much appreciated! Thanks!
Flags: needinfo?(pmac)
Whiteboard: [kanban:https://kanbanize.com/ctrl_board/4/98]
Attached image nr_basket_dev.png —
Attached image nr_basket_stage.png —
I think, if I'm reading these charts correctly, I have NR reporting the celery processes as part of the "Non-web" work for both the basket-dev.allizom.org and basket.allizom.org "applications". pmac: Can you please confirm that there has been no unintended side effects in dev and stage? If there aren't, is there a particular good or bad time to make this change to basket.mozilla.org? It will require a reboot of the celery processes in order to pick up the NewRelic changes. I needed to be able to specify different NewRelic application names in order to associate a specific application name with a specific set of celery processes. The basket celery processes share the generic celery clusters (dev, stage, and prod) with other applications (like autoland and reps).
Flags: needinfo?(pmac)
Assignee: server-ops-webops → cliang
It looks good to me. Everything looks fine on NR for basket.allizom.org, so I'd say you can go ahead with rolling it out on prod. Be sure to ping me when you do so I can check it out quickly. But I think this week would work fine for pushing out this change. Thanks again!
Flags: needinfo?(pmac)
After pinging pmac in IRC, I pushed the NewRelic changes into production today (June 18th) at 16:00 UTC. For future WebOps reference, it looks like the production side implements celery services slightly differently than on dev and stage (probably because rabbit is housed directly on those servers). I modified the celery::service2 definition in puppet to accommodate for those differences. It looks like NR is correctly reporting non-web traffic from the celery servers. Closing this bug for now; if we find non-obvious breakage later, this bug should be reopened.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Product: Infrastructure & Operations → Infrastructure & Operations Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: