Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

tracing not working with celery worker #345

Closed
matthieudesprez opened this issue May 10, 2021 · 3 comments · Fixed by #346
Closed

tracing not working with celery worker #345

matthieudesprez opened this issue May 10, 2021 · 3 comments · Fixed by #346
Assignees
Labels
bug Something isn't working released

Comments

@matthieudesprez
Copy link

I didn't get the time to dig too far but I can't have epsagon traces with celery.

From what I've seen, the _get_trace function returns None, as the unique_id is None and the singleton_trace is also None.

I'm running celery with the following command:

celery -A <app_name> worker --beat --scheduler django

and I tried both the auto tracing config and calling epsagon.init directly, but the outcome is the same.

@ranrib
Copy link
Member

ranrib commented May 10, 2021

Hi @matthieudesprez, can you share celery version and example snippet?
also can you set EPSAGON_DEBUG=TRUE logs?

@matthieudesprez
Copy link
Author

python_version = "3.8.1"
celery = "==5.0.5"
epsagon = "==1.64.2"

celery_epsagon/tasks.py

import os

import epsagon
from celery import Celery

epsagon.init(
    token='epsagon-token',
    app_name='app-name',
    debug=True,
)

broker_dir = "./broker"

# create broker folders
for f in ["out", "processed"]:
    if not os.path.exists(os.path.join(broker_dir, f)):
        os.makedirs(os.path.join(broker_dir, f))

app = Celery("tasks")

app.conf.update(
    {
        "broker_url": "filesystem://",
        "broker_transport_options": {
            "data_folder_in": os.path.join(broker_dir, "out"),
            "data_folder_out": os.path.join(broker_dir, "out"),
            "data_folder_processed": os.path.join(broker_dir, "processed"),
        },
    }
)

@app.task
def add(x, y):
    return x + y

Execution

celery -A celery_epsagon.tasks worker --loglevel=DEBUG
python
>>> from celery_epsagon.tasks import add
>>> add.delay(4, 4)
<AsyncResult: ...>

Some output I have managed to log in the celery process:

[...: WARNING/ForkPoolWorker-1] __file__='.../lib/python3.8/site-packages/epsagon/trace.py' 487 trace=None

@ranrib ranrib self-assigned this May 16, 2021
@ranrib ranrib added the bug Something isn't working label May 16, 2021
@ranrib
Copy link
Member

ranrib commented May 16, 2021

🎉 This issue has been resolved in version 1.66.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants