Prometheus - Queue stats

Hi,

Is there a way to include ‘queue show’ stats in the prometheus metrics?

I didn’t found documentation about Prometheus, only about the config file parameters. But In the changelog, when added suport to prometheus:

Add core Prometheus support to Asterisk
...
(2) Scrape callbacks. In this case, the API allows consumers to be called via a callback function when a Prometheus initiated scrape occurs.

Anyone could tell me if it is possible to generate a callback function that collect metrics form queue stats?

Or any pointing of where to start…

Best regards!

What you are referring to is C level code, so you’d have to write an implementation of the prometheus stuff for app_queue.

Ok, I thought that it could be a callback to a program like AGI.

There’s a lot of years that I didn’t program anything in C… also I don’t know too much about the asterisk source…

I took a look ar res/prometheus/*.c

For example, in channels.c for obtaining channels uses:

channels = ast_channel_cache_all();
num_channels = ao2_container_count(channels);

I could try to make a PR, but I’ll need to know how to obtain the results of ‘queue stats’ as a starting point. Do you know how can retrieve this data?

Thanks for your help!

I have little to no experience in app_queue.

Thanks jcolp.

If anyone else knows how to obtain these stats I could try to make the PR, if not, I’ll wait until app_queue developers implement it with prometheus… it will be a good stuff.

Best regards!