Module: kamailio
Branch: master
Commit: 02f7ace19b49a16ccacc7d83f4717f6492ff56fa
URL: 
https://github.com/kamailio/kamailio/commit/02f7ace19b49a16ccacc7d83f4717f6492ff56fa

Author: Joel Serrano <[email protected]>
Committer: GitHub <[email protected]>
Date: 2025-12-11T23:03:28+01:00

xhttp_prom: don't sanitize tag values in exported metrics (#4519)

Fixes #4508

---

Modified: src/modules/xhttp_prom/prom.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/02f7ace19b49a16ccacc7d83f4717f6492ff56fa.diff
Patch: 
https://github.com/kamailio/kamailio/commit/02f7ace19b49a16ccacc7d83f4717f6492ff56fa.patch

---

diff --git a/src/modules/xhttp_prom/prom.c b/src/modules/xhttp_prom/prom.c
index a1aedcc7e0a..20bf6ffe428 100644
--- a/src/modules/xhttp_prom/prom.c
+++ b/src/modules/xhttp_prom/prom.c
@@ -191,14 +191,19 @@ static int metric_generate(
                        (uint64_t)ts);
 
        /* Print metric name. */
-       if(prom_body_name_printf(ctx, "%.*s%.*s_%.*s%s", 
xhttp_prom_beginning.len,
-                          xhttp_prom_beginning.s, group->len, group->s, 
name->len, name->s,
-                          xhttp_prom_tags_braces)
+       if(prom_body_name_printf(ctx, "%.*s%.*s_%.*s", xhttp_prom_beginning.len,
+                          xhttp_prom_beginning.s, group->len, group->s, 
name->len, name->s)
                        == -1) {
                LM_ERR("Fail to print\n");
                return -1;
        }
 
+       /* xhttp_prom_tags_braces is not sanitized any more because UTF-8 
characters are allowed */
+       if(prom_body_printf(ctx, "%s", xhttp_prom_tags_braces) == -1) {
+               LM_ERR("Fail to print\n");
+               return -1;
+       }
+
        if(prom_body_printf(ctx, " %lu %" PRIu64 "\n", counter_val, 
(uint64_t)ts)
                        == -1) {
                LM_ERR("Fail to print\n");

_______________________________________________
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!

Reply via email to