Menu Search

D.3. Examples

Adding a statistic reporting pattern to a single queue, called myqueue using the REST API and cURL. This example uses ancestor references to include entity names:

Example D.1. Enabling statistics for a single queue using the REST API and cURL

curl --user admin --data '{"name" : "qpid.queue.statisticsReportPattern", "value" : "${ancestor:virtualhost:name}/${ancestor:queue:name}: queueDepthMessages=${queueDepthMessages}, queueDepthBytes=${queueDepthBytes:byteunit}"}' https://localhost:8080/api/latest/queue/default/default/myqueue/setContextVariable

Once enabled, an example statistic report output written to the log might look like this:

2017-10-15 13:03:12,993 INFO  [virtualhost-default-pool-0] (q.s.Queue) - Statistics: default/myqueue: queueDepthMessages=0, queueDepthBytes=0 B
2017-10-15 13:03:22,979 INFO  [virtualhost-default-pool-2] (q.s.Queue) - Statistics: default/myqueue: queueDepthMessages=3, queueDepthBytes=345 B
2017-10-15 13:03:32,981 INFO  [virtualhost-default-pool-2] (q.s.Queue) - Statistics: default/myqueue: queueDepthMessages=3, queueDepthBytes=345 B

Removing a statistic report pattern from the same queue:

Example D.2. Disabling statistics for a single queue using the REST API and cURL

curl --user admin --data '{"name" : "qpid.queue.statisticsReportPattern"}' https://localhost:8080/api/latest/queue/default/default/myqueue/setContextVariable

Adding a statistic reporting pattern to all queues:

Example D.3. Enabling statistics for all queues using the REST API and cURL

curl --user admin --data '{"name" : "qpid.queue.statisticsReportPattern", "value" : "${ancestor:virtualhost:name}/${ancestor:queue:name}: oldestMessageAge=${oldestMessageAge:duration}"}' https://localhost:8080/api/latest/virtualhost/default/default/setContextVariable

Once enabled, an example statistic report for a virtualhost with two queues might look like this:

2017-10-15 13:17:42,918 INFO  [virtualhost-default-pool-1] (q.s.Queue) - Statistics: default/myqueue1: oldestMessageAge=PT1M24S
2017-10-15 13:17:42,918 INFO  [virtualhost-default-pool-1] (q.s.Queue) - Statistics: default/myqueue2: oldestMessageAge=PT0S