new prometheus metrics

390 views
Skip to first unread message

ADNANE DAKNA

unread,
May 25, 2022, 7:13:16 AM5/25/22
to rtpengine
Hello @Guys  
how can I add more  prometheus  metrics to http interface

Richard Fuchs

unread,
May 25, 2022, 7:46:11 AM5/25/22
to rtpe...@googlegroups.com
On 25/05/2022 07.13, [EXT] ADNANE DAKNA wrote:
> Hello @Guys
> how can I add more  prometheus  metrics to http interface

Metrics and statistics exporting is consolidated in
statistics_gather_metrics() here:
https://github.com/sipwise/rtpengine/blob/master/daemon/statistics.c#L330

To add a new metric for Prometheus, add a new METRIC() here in the
appropriate section, followed by a PROM() that describes the metric for
the Prometheus export.

Of course you need to figure out which value you want to export. If the
metric isn't available as such yet, you can add a new field to the
dedicated stats collection routines. There's support for built-in
counter-type stats, as well as gauge-style stats:
https://github.com/sipwise/rtpengine/blob/master/include/counter_stats_fields.inc
and
https://github.com/sipwise/rtpengine/blob/master/include/gauge_stats_fields.inc

With these you can use the RTPE_* macros elsewhere in the code to
measure anything you like:
https://github.com/sipwise/rtpengine/blob/master/include/call.h#L611

There's examples of these being used throughout the code.

Cheers

Reply all
Reply to author
Forward
0 new messages