<p></p>
<h3>Description</h3>
<p>We tried to use the <code>xhttp_prom</code>  module, but our Prometheus couldn't read it, because of metrics conflicting with Prometheus data model.</p>
<p>For us, the problem lies in the usrloc module. It exports the following metrics:</p>
<pre><code>usrloc:location-contacts = 0
usrloc:location-expires = 0
usrloc:location-users = 0
usrloc:registered_users = 0
</code></pre>
<p>However, Prometheus allows only ascii characters and digits, as well as underscores and colons.<br>
See: <a href="https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels" rel="nofollow">https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels</a></p>
<p>The metrics names should not contain <code>-</code>, so they should get converted to <code>_</code>.</p>
<h4>Reproduction</h4>
<p>Setup Kamailio with <code>usrloc</code>, <code>xhttp</code> and <code>xhttp_prom</code> module and let Prometheus query it. It will stumble upon the first entry of <code>usrloc</code> module stats.</p>
<h3>Possible Solutions</h3>
<p>Either the <code>usrloc</code> module could export its stats with the dash replaced by underscores, or the xhttp_prom module could sanitize the output. The first one would be a breaking change, I guess, making this a change for a major release.</p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>root@ifens5:/# kamailio -v
version: kamailio 5.3.8 (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, 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_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_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 7.5.0```

* **Operating System**:

</code></pre>
<p>Ubuntu 18.04</p>
<pre><code></code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2644">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZNTW4RE7VMXEXXLU6DTAKBLTANCNFSM4YA2SRPQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZKHYBHXSVV4BOIDYR3TAKBLTA5CNFSM4YA2SRP2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4MD7PCJA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2644",
"url": "https://github.com/kamailio/kamailio/issues/2644",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>