Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
264 views
in Technique[技术] by (71.8m points)

python - Missing DataDog metrics when using ThreadStats for a Celery task in Django

The problem

I have a scheduled Celery task that queries x number of rows, does some processing and upon success (or error) it increments a specific metric using ThreadStats. For each execution of this task, the metric should be incremented by x at a specific time.

The problem is that some of these increments are not posted to DataDog. Ex. if the total number of rows is 100 and the task processes x=10 at a time, some of those task executions fails to increment the metric and it ends up displaying only 60.

Attempts for resolution

This is what I tried to do without success:

  1. Manually flushing the metrics in the task by setting flush_in_thread=False and calling the flush() method.
  2. Using dogstatsd-collector library to delay the submission

question from:https://stackoverflow.com/questions/65603045/missing-datadog-metrics-when-using-threadstats-for-a-celery-task-in-django

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...