newrelic-python-agent icon indicating copy to clipboard operation
newrelic-python-agent copied to clipboard

Celery tracing has stopped reporting to new relic console after version 9.9

Open fernandoaguilar opened this issue 1 year ago • 1 comments

Description After upgrading to agent version 9.13.0 celery monitoring has stopped reporting and showing up in new relic console. I noticed it stopped working after version 9.9.0.

Expected Behavior celery metrics should report to new relic console.

Troubleshooting or NR Diag results tried using nrdiag but its not detecting the virtual environement, therefore it fails to detect newrelic is even installed.

Steps to Reproduce CELERY_BIN="NEW_RELIC_CONFIG_FILE=/path/to/newrelic.ini /path/to/newrelic-admin run-program /path/to/celery" service file

[Unit]
Description=Celery Service
After=network.target

[Service]
Type=forking
User=ubuntu
Group=ubuntu
EnvironmentFile=/etc/default/celeryd
WorkingDirectory=/srv/plugshare
ExecStart=/bin/sh -c '${CELERY_BIN} -A ${CELERY_APP} multi start ${CELERYD_NODES} \
  --pidfile=${CELERYD_PID_FILE} \
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
  --pidfile=${CELERYD_PID_FILE}'
ExecReload=/bin/sh -c '${CELERY_BIN} -A ${CELERY_APP} multi restart ${CELERYD_NODES} \
  --pidfile=${CELERYD_PID_FILE} \
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'

[Install]
WantedBy=multi-user.target

Your Environment new relic agent: 9.13.0 celery version 5.4.0 python 3.11

fernandoaguilar avatar Sep 24 '24 22:09 fernandoaguilar

https://new-relic.atlassian.net/browse/NR-316900

Hello--sorry about the delay on this one. Are you using a custom base task for any of your tasks, perhaps? We had a similar issue with this that involved New Relic missing some instrumentation for custom base tasks in subsequent versions. If not, would it be possible to get a basic repro of your app?

lrafeei avatar Nov 20 '24 19:11 lrafeei

All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.

Hi @lrafeei, we're also experiencing the same issue on 10.6.0 - we are using custom base tasks for some tasks which aren't working.

Are there any known workarounds?

amcgavin avatar Feb 25 '25 03:02 amcgavin

Hello--sorry about the delay on this one. Are you using a custom base task for any of your tasks, perhaps? We had a similar issue with this that involved New Relic missing some instrumentation for custom base tasks in subsequent versions. If not, would it be possible to get a basic repro of your app?

Yes we are using custom base task for all tasks. I no longer am working on that code, so I won't be able to provide a repro.

fernandoaguilar avatar Feb 25 '25 04:02 fernandoaguilar

Hello--

Long story short, we need to do some longer term fixes to get this to work properly, but in the meantime, could you try this workaround?

https://github.com/newrelic/newrelic-python-agent/issues/1243#issuecomment-2536839894

lrafeei avatar Feb 26 '25 17:02 lrafeei

The problem is a duplicate of an existing issue.

For some reason, the github ticket was closed, but the work is being tracked here: https://new-relic.atlassian.net/browse/NR-373685

lrafeei avatar Feb 26 '25 18:02 lrafeei

@lrafeei I'm unable to view that link. Is there somewhere public where I can track the work for the root cause?

amcgavin avatar May 06 '25 05:05 amcgavin

Hello--

We have a branch up that should solve this issue. If anyone wants to test it out before we release it, the branch is celery-custom-task-instrumentation

lrafeei avatar Jul 23 '25 22:07 lrafeei