Calculating rate of tasks per minute

Firstly I’m new to InfluxDB so trying to get my head around it!

I have a system that periodically checks if there are any tasks to perform in a queue and processes them. The timestamped log contains:

  • The initial size of the task queue
  • A message every 100 tasks saying how many tasks remain
  • A message once the queue is empty

It may take many minutes to process 100 tasks. After the queue is empty it waits X minutes and checks the queue again.

I can scrape the log and put data into InfluxDB but what I want to understand is:

  • firstly what values should I insert? The remaining queue size or the number of tasks it’s completed since the last insert eg ‘100’ (or less)
  • what query do I run to find out the rate of tasks per minute. I’d like to graph this rate in Grafana.

Many thanks.

You want to try the functions under Transformations category
Derivative() - Returns the rate of change between subsequent [field values]
Difference() - Returns the result of subtraction between subsequent
NON_NEGATIVE_DERIVATIVE() - To get positive increments