joelsdc created an issue (kamailio/kamailio#4574)
## Description
Given the following
[xhttp_prom_tags](https://www.kamailio.org/docs/modules/stable/modules/xhttp_prom.html#xhttp_prom.p.xhttp_prom_tags)
config:
```
modparam("xhttp_prom", "xhttp_prom_uptime_stat", 1)
modparam("xhttp_prom", "xhttp_prom_tags", "hostname=\"kamailio-test\"");
modparam("xhttp_prom", "prom_counter", "name=kamailio_test_metric_one;
label=label1:label2:label3");
modparam("xhttp_prom", "prom_counter", "name=kamailio_test_metric_two;
label=label1:label2");
modparam("xhttp_prom", "xhttp_prom_stats", "all")
modparam("xhttp_prom", "xhttp_prom_pkg_stats", 1)
```
When you scrape the metrics endpoint, the custom metrics (in this case:
`kamailio_test_metric_one` and `kamailio_test_metric_two`) don't include the
tags configured in **xhttp_prom_tags**.
Example:
```
kamailio_test_metric_one{label1="XXX", label2="YYY", label3="ZZZ"} 3
1769758020393
kamailio_test_metric_two{label1="XXX", label2="YYY"} 68 1769758020393
kamailio_core_drop_requests{hostname="kamailio-test"} 177 1769758020393
kamailio_core_err_requests{hostname="kamailio-test"} 0 1769758020393
kamailio_core_fwd_requests{hostname="kamailio-test"} 0 1769758020393
```
Expected:
```
kamailio_test_metric_one{hostname="kamailio-test", label1="XXX", label2="YYY",
label3="ZZZ"} 3 1769758020393
kamailio_test_metric_two{hostname="kamailio-test", label1="XXX", label2="YYY"}
68 1769758020393
kamailio_core_drop_requests{hostname="kamailio-test"} 177 1769758020393
kamailio_core_err_requests{hostname="kamailio-test"} 0 1769758020393
kamailio_core_fwd_requests{hostname="kamailio-test"} 0 1769758020393
```
## Troubleshooting
## Reproduction
Load xhttp_prom.
Configure:
```
modparam("xhttp_prom", "xhttp_prom_uptime_stat", 1)
modparam("xhttp_prom", "xhttp_prom_tags", "hostname=\"kamailio-test\"");
modparam("xhttp_prom", "prom_counter", "name=kamailio_test_metric_one;
label=label1:label2:label3");
modparam("xhttp_prom", "prom_counter", "name=kamailio_test_metric_two;
label=label1:label2");
modparam("xhttp_prom", "xhttp_prom_stats", "all")
modparam("xhttp_prom", "xhttp_prom_pkg_stats", 1)
```
And the minimal config in http event_route:
```
event_route[xhttp:request] {
# Prometheus metrics endpoint
if (prom_check_uri()) {
prom_dispatch();
exit;
}
xhttp_reply("404", "Not found", "text/html", "<html><body>Wrong URL
$hu</body></html>");
return;
}
```
Somewhere in the request_route add:
```
prom_counter_inc("kamailio_test_metric_one", "1", "XXX", "YYY", "ZZZ");
prom_counter_inc("kamailio_test_metric_two", "1", "XXX", "YYY");
```
Start Kamailio.
Generate traffic so the counter is incremented.
Fetch `/metrics` (e.g., `curl -s http://<kamailio-ip>:<port>/metrics`).
Observe the labels on the custom metrics.
### Debugging Data
<!--
If you got a core dump, use gdb to extract troubleshooting data - full
backtrace,
local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile
bt full
info locals
list
If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->
```
(n/a - config/formatting issue; no crash)
```
### Log Messages
<!--
Check the syslog file and if there are relevant log messages printed by
Kamailio, add them next, or attach to issue, or provide a link to download them
(e.g., to a pastebin site).
-->
```
(n/a - no relevant errors logged)
```
### SIP Traffic
<!--
If the issue is exposed by processing specific SIP messages, grab them with
ngrep or save in a pcap file, then add them next, or attach to issue, or
provide a link to download them (e.g., to a pastebin site).
-->
```
(n/a)
```
## Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 6.0.5 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE,
USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC,
F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT,
USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES,
TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE
262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 14.2.0
```
* **Operating System**:
<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu
16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `lsb_release -a` and `uname -a`)
-->
```
Linux kamailio-test 6.12.63+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.63-1
(2025-12-30) x86_64 GNU/Linux
Distributor ID: Debian
Description: Debian GNU/Linux 13 (trixie)
Release: 13
Codename: trixie
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4574
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/[email protected]>_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!