OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.29k stars 582 forks source link

[BUG] prometheus: handling of pkmem and load statistics #2482

Open ovidiusas opened 3 years ago

ovidiusas commented 3 years ago

Using prometheus module in the following config:

loadmodule "prometheus.so"
  modparam("prometheus", "group_mode", 1)
  modparam("prometheus", "statistics", "pkmem:")

will generate the following metrics:

opensips_pkmem_0-total_size 0
opensips_pkmem_0-used_size 0
opensips_pkmem_0-real_used_size 0
opensips_pkmem_0-max_used_size 0
opensips_pkmem_0-free_size 0
opensips_pkmem_0-fragments 0

It would help a lot to have this metrics generated in the following format:

opensips_pkmem_total_size{id="0",pid="1234",type="attendant"} 0
opensips_pkmem_used_size{id="0",pid="1234",type="attendant"} 0
opensips_pkmem_real_used_size{id="0",pid="1234",type="attendant"} 0
opensips_pkmem_max_used_size{id="0",pid="1234",type="attendant"} 0
opensips_pkmem_free_size{id="0",pid="1234",type="attendant"} 0
opensips_pkmem_fragments{id="0",pid="1234",type="attendant"} 0

The pid and type can be retrieved from the output of the ps mi command.

Similar output should be used for the load: statistics.

razvancrainea commented 3 years ago

Hi, Ovidiu!

Just pushed the code to support these requirements. Any chance you could run a quick test and get some feedback about the output?

Best regards, Răzvan

ovidiusas commented 3 years ago

Everything looks good!

Two small improvement for load.

It seems that for the main proc, we provide a set of separate metrics:

# TYPE opensips_load_load gauge
opensips_load_load 0
# TYPE opensips_load_load1m gauge
opensips_load_load1m 0
# TYPE opensips_load_load10m gauge
opensips_load_load10m 0

It would make sense to integrate them into the other per proc metrics and set the id="0", pid set to the real pid and descritption "main proc" or something like that. This would look like this:

opensips_load_proc_load{id="0",pid="23723",desc="main proc"} 0
opensips_load_proc_load1m{id="0",pid="23723",desc="main proc"} 0
opensips_load_proc_load10m{id="0",pid="23723",desc="main proc"} 0

Next, we have three types of loads: instant, 1m and 10m. One option would be to provide a single metric and add an interval label like duration set to 0, 60 and 600 (that would be the interval in seconds for computed load).

This would translate from:

opensips_load_proc_load{id="1",pid="23724",desc="MI FIFO"} 0
opensips_load_proc_load1m{id="1",pid="23724",desc="MI FIFO"} 0
opensips_load_proc_load10m{id="1",pid="23724",desc="MI FIFO"} 0

into

opensips_load_proc_load{id="1",pid="23724",desc="MI FIFO",interval="0"} 0
opensips_load_proc_load{id="1",pid="23724",desc="MI FIFO",interval="60"} 0
opensips_load_proc_load{id="1",pid="23724",desc="MI FIFO",interval="600"} 0

All of this are small improvements and can be implemented into the next release.