Metrics
Karma collects metrics for most of its operations to provide insight into the application and hints on how to optimize it.
Configuration
Metrics can be accessed through the health-check endpoints.
The default configuation is:
'health-check':
server:
port: 9001
host: '127.0.0.1'
If the endpoints should be accessible from other hosts, you should bind to 0.0.0.0 or an external IP address of the host:
'health-check':
server:
host: '0.0.0.0'
All endpoints can be protected using access tokens. You can define one or more tokens:
'health-check':
server:
# openssl rand -base64 23 | tr -d '/+='
tokens:
- Nz1THLT4yTEZtt156DBePWDHM6Q9ibM
- kS1J60atX3CBtrK8nc1Udb2Q7aHVBcw
If no tokens are defined the endpoints are public accessible.
One of the configured token mus be included in the request either
in the Authorization header (Authorization: Bearer <token>) or as
query parameter (http://karma.server:9001/-/status?token= <token>).
For the curl examples below add: -H "Authorization: Bearer <token>"
Endpoints
Status
curl -X GET http://karma.server:9001/-/status
{
"cluster": {
"workers": {
"size": 1,
"missing": 0,
"connected": 1
}
},
"process": {
"uptime": 326.213
}
}
Prometheus Metrics
curl -X GET http://karma.server:9001/-/metrics
# HELP process_cpu_user_seconds_total Total user CPU time spent in seconds.
# TYPE process_cpu_user_seconds_total counter
process_cpu_user_seconds_total 5.163402000000001
# ... and a lot more
LDAP metrics
These metrics show the load Karma puts on the LDAP server and how often Karma replaces its pooled LDAP connections.
| Metric | Type | Labels | Meaning |
|---|---|---|---|
ldap_search_seconds | histogram | scope, sizeLimit, filter, controls, status | Time an LDAP search took, in seconds. filter is the shape of the search filter with the values left out, so searches of the same kind share one series. |
ldap_connections_created_total | counter | none | LDAP connections opened. Counts each new connection that connected and joined the connection pool, including connections that replace removed ones. |
ldap_connection_removals_total | counter | none | LDAP connections the connection pool removed. Counts each connection once when the pool drops it after an operation timeout, a connection error or a failed connection check, or replaces it with a new one. If the network connection just closes, the connection stays in the pool and is not counted. |
ldap_connect_timeouts_total | counter | none | New connections that timed out while connecting. Counts each time the LDAP server did not accept the first connect attempt of a new connection within ldap.connectTimeout (default 15000 milliseconds). Such a connection never joins the connection pool, so the other connection metrics do not count it. |
ldap_pool_connections | gauge | none | LDAP connections in the connection pool at the time of the request, added up over all worker processes of the server. A connection whose network connection just closed is still in the pool and still counted, so this is not the number of open network connections. |
A steadily rising ldap_connection_removals_total together with
ldap_connections_created_total means the connection pool keeps dropping and
replacing LDAP connections, usually because the LDAP server answers too slowly.
For the current number of pooled connections, use ldap_pool_connections
rather than the difference of the two counters: the counters start again at 0
when a worker process restarts, and connections closed when Karma shuts down
are not counted as removed.