danyi1212 / celery-insights

Real-Time monitoring tool for Celery
https://celery-insights.vercel.app
BSD 3-Clause "New" or "Revised" License
45 stars 3 forks source link

[BUG] arguments and results is shown with empty/Null although I am sure they have values #50

Open johnfawzy84 opened 6 days ago

johnfawzy84 commented 6 days ago

Describe the bug I have a configuration where redis is working as broker and results backend. I can see the tasks when I trigger/clients but I always see the Arguments and results with Empty/None in the tasks view. e.g. http://localhost:8555/tasks/ the tasks has a result and/or arguments, I can see this in the (Tasks explorer)

To Reproduce Steps to reproduce the behavior:

  1. Start a celery chain where the tasks has arguments and return vaules
  2. click from the tasks explorer on a task
  3. Scroll down to see Arguments and Results in the tasks view
  4. See that arguments is empty and results has None

Expected behavior Arguments / Kwargs will have values Results will have values

Screenshots If applicable, add screenshots to help explain your problem.

image

Additional context the result backend and the broker are both redis.

danyi1212 commented 4 days ago

Hey, just to make sure - have you enabled result_extended=True in your Celery app? https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended

It is recommended here in the README.md, this potentially could be added to the UI as well. https://github.com/danyi1212/celery-insights?tab=readme-ov-file#enabling-celery-events

johnfawzy84 commented 4 days ago

yeah, I enabled result_extended Here is the configuration block ` app.conf.worker_send_task_events = True

app.conf.task_send_sent_event = True

app.conf.task_track_started = True

app.conf.result_extended = True `

Actually in the state.json, I can see the values correctly.

An example for the json output of state is something like : ` 17  
id "1212ed51-b525-470c-9eba-f4a2453768ba"
type "Create Order for Something"
state "SUCCESS"
sent_at 1728639287.4776063
received_at 1728639287.4232242
started_at 1728639287.4248035
succeeded_at 1728639287.4776063
failed_at null
retried_at null
revoked_at null
rejected_at null
runtime 0.052537856998242205
last_updated 1728639287.4776063
args "()"
kwargs "{'order_id': UUID('ee6c13a4-4ad6-4a16-9756-665fe6baedcf')}"
eta null
expires null
retries 0
exchange null
routing_key null
root_id "06648238-457d-41e9-9f18-89398ccd82f9"
parent_id "f9d420f2-d21a-490f-94df-ea41851ba517"
children  
0 "581dd489-4dbe-4dd3-9ab6-5e140f0650ad"
worker "celery_worker@114a8d7a90e8-1"
result "UUID('fd6c114a-9120-44b3-a00a-22b8b05b127f')"
exception null
traceback null

`

danyi1212 commented 2 days ago

Interesting, did you take that state.json from the Debug Bundle? Can you please share what is responded from the /api/tasks/{task_id}/result call in the task details from the browser's network tab?

johnfawzy84 commented 2 days ago

yes, I did take the state.json out of the Debug Bundle. The output of the /api/tasks/{task_id}/result is : { "id": "d8aaba40-38af-4661-9a56-64aaf8196f62", "type": null, "state": "PENDING", "queue": null, "result": null, "traceback": null, "ignored": false, "args": [], "kwargs": {}, "retries": 0, "worker": null }