Example: Rate Statistics
A quick example: I want to gather some message rate statistics. Here is an API call to do that for a queue named hello
(from my “Hello World” set-up):
http://localhost:15672/api/queues?name=hello&columns=name,message_stats.publish,message_stats.publish_details&msg_rates_age=100&msg_rates_incr=20
/api/queues
- the type of Rabbit object I want to investigate
name=hello
- the name of a specific queue
columns=name,message_stats.publish,message_stats.publish_details
- the specific JSON fields I want to retrieve (out of a fairly lengthy list of possible fields!). Remove this parameter to see everything.
msg_rates_age=100
- go back over the most recent 100
seconds of history.
msg_rates_incr=20
- take data samples once every 20
seconds - so, that will be 6 samples overall (0 seconds ago, 20, 40, 60, 80, 100 seconds ago).
The JSON response:
|
|
Each sample
value shows how many published messages there have been in total from the initial creation of the queue through to the timestamp
value (milliseconds since the Unix epoch).
There are three detailed statistics provided:
avg
: average value (in this case, for “messages published” on this one queue) for the time period.
This is calculated as: (5+4+2+2+2+2) / 6 = 2.83333
rate
: change per second in most recent sampling interval.
This is calculated as: (5-4) / 20 = 0.05
avg_rate
: average rate for the time period.
This is calculated as: (5-2) / 100 = 0.03
If you wanted to know rates going back in time, you would need to parse the JSON subtract each successive sample
number from the previous (more recent) sample
number.
The Documentation
The main page is here: