MINOR: contrib/prometheus-exporter: Rename some metrics to be more usable
Some metrics have been renamed and their type adapted to be more usable in
Prometheus:
* haproxy_process_uptime_seconds -> haproxy_process_start_time_seconds
* haproxy_process_max_memory -> haproxy_process_max_memory_bytes
* haproxy_process_pool_allocated_total -> haproxy_process_pool_allocated_bytes
* haproxy_process_pool_used_total -> haproxy_process_pool_used_bytes
* haproxy_process_ssl_cache_lookups -> haproxy_process_ssl_cache_lookups_total
* haproxy_process_ssl_cache_misses -> haproxy_process_ssl_cache_misses_total
No backport needed. See issue #81 on github.
diff --git a/contrib/prometheus-exporter/README b/contrib/prometheus-exporter/README
index 1fb5503..d02c64d 100644
--- a/contrib/prometheus-exporter/README
+++ b/contrib/prometheus-exporter/README
@@ -61,17 +61,17 @@
| haproxy_process_nbthread | Configured number of threads. |
| haproxy_process_nbproc | Configured number of processes. |
| haproxy_process_relative_process_id | Relative process id, starting at 1. |
-| haproxy_process_uptime_seconds | Uptime in seconds. |
-| haproxy_process_max_memory | Per-process memory limit (in MB); 0=unset. |
-| haproxy_process_pool_allocated_total | Total amount of memory allocated in pools (in MB). |
-| haproxy_process_pool_used_total | Total amount of memory used in pools (in MB). |
+| haproxy_process_start_time_seconds | Start time in seconds. |
+| haproxy_process_max_memory_bytes | Per-process memory limit (in bytes); 0=unset. |
+| haproxy_process_pool_allocated_bytes | Total amount of memory allocated in pools (in bytes). |
+| haproxy_process_pool_used_bytes | Total amount of memory used in pools (in bytes). |
| haproxy_process_pool_failures_total | Total number of failed pool allocations. |
| haproxy_process_max_fds | Maximum number of open file descriptors; 0=unset. |
| haproxy_process_max_sockets | Maximum numer of open sockets. |
| haproxy_process_max_connections | Maximum number of concurrent connections. |
| haproxy_process_hard_max_connections | Initial Maximum number of concurrent connections. |
| haproxy_process_current_connections | Number of active sessions. |
-| haproxy_process_connections_total | Total number of terminated sessions. |
+| haproxy_process_connections_total | Total number of created sessions. |
| haproxy_process_requests_total | Total number of requests (TCP or HTTP). |
| haproxy_process_max_ssl_connections | Configured maximum number of concurrent SSL connections. |
| haproxy_process_current_ssl_connections | Number of opened SSL connections. |
@@ -93,8 +93,8 @@
| haproxy_process_frontent_ssl_reuse | SSL session reuse ratio (percent). |
| haproxy_process_current_backend_ssl_key_rate | Current backend SSL Key computation per second over last elapsed second. |
| haproxy_process_max_backend_ssl_key_rate | Maximum observed backend SSL Key computation per second. |
-| haproxy_process_ssl_cache_lookups | Total number of SSL session cache lookups. |
-| haproxy_process_ssl_cache_misses | Total number of SSL session cache misses. |
+| haproxy_process_ssl_cache_lookups_total | Total number of SSL session cache lookups. |
+| haproxy_process_ssl_cache_misses_total | Total number of SSL session cache misses. |
| haproxy_process_http_comp_bytes_in_total | Number of bytes per second over last elapsed second, before http compression. |
| haproxy_process_http_comp_bytes_out_total | Number of bytes per second over last elapsed second, after http compression. |
| haproxy_process_limit_http_comp | Configured maximum input compression rate in bytes. |
diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c
index dd9128a..bf94b85 100644
--- a/contrib/prometheus-exporter/service-prometheus.c
+++ b/contrib/prometheus-exporter/service-prometheus.c
@@ -430,10 +430,10 @@
[INF_PROCESS_NUM] = IST("relative_process_id"),
[INF_PID] = IST("pid"),
[INF_UPTIME] = IST("uptime"),
- [INF_UPTIME_SEC] = IST("uptime_seconds"),
- [INF_MEMMAX_MB] = IST("max_memory"),
- [INF_POOL_ALLOC_MB] = IST("pool_allocated_total"),
- [INF_POOL_USED_MB] = IST("pool_used_total"),
+ [INF_UPTIME_SEC] = IST("start_time_seconds"),
+ [INF_MEMMAX_MB] = IST("max_memory_bytes"),
+ [INF_POOL_ALLOC_MB] = IST("pool_allocated_bytes"),
+ [INF_POOL_USED_MB] = IST("pool_used_bytes"),
[INF_POOL_FAILED] = IST("pool_failures_total"),
[INF_ULIMIT_N] = IST("max_fds"),
[INF_MAXSOCK] = IST("max_sockets"),
@@ -462,8 +462,8 @@
[INF_SSL_FRONTEND_SESSION_REUSE_PCT] = IST("frontent_ssl_reuse"),
[INF_SSL_BACKEND_KEY_RATE] = IST("current_backend_ssl_key_rate"),
[INF_SSL_BACKEND_MAX_KEY_RATE] = IST("max_backend_ssl_key_rate"),
- [INF_SSL_CACHE_LOOKUPS] = IST("ssl_cache_lookups"),
- [INF_SSL_CACHE_MISSES] = IST("ssl_cache_misses"),
+ [INF_SSL_CACHE_LOOKUPS] = IST("ssl_cache_lookups_total"),
+ [INF_SSL_CACHE_MISSES] = IST("ssl_cache_misses_total"),
[INF_COMPRESS_BPS_IN] = IST("http_comp_bytes_in_total"),
[INF_COMPRESS_BPS_OUT] = IST("http_comp_bytes_out_total"),
[INF_COMPRESS_BPS_RATE_LIM] = IST("limit_http_comp"),
@@ -586,17 +586,17 @@
[INF_PROCESS_NUM] = IST("Relative process id, starting at 1."),
[INF_PID] = IST("HAProxy PID."),
[INF_UPTIME] = IST("Uptime in a human readable format."),
- [INF_UPTIME_SEC] = IST("Uptime in seconds."),
- [INF_MEMMAX_MB] = IST("Per-process memory limit (in MB); 0=unset."),
- [INF_POOL_ALLOC_MB] = IST("Total amount of memory allocated in pools (in MB)."),
- [INF_POOL_USED_MB] = IST("Total amount of memory used in pools (in MB)."),
+ [INF_UPTIME_SEC] = IST("Start time in seconds."),
+ [INF_MEMMAX_MB] = IST("Per-process memory limit (in bytes); 0=unset."),
+ [INF_POOL_ALLOC_MB] = IST("Total amount of memory allocated in pools (in bytes)."),
+ [INF_POOL_USED_MB] = IST("Total amount of memory used in pools (in bytes)."),
[INF_POOL_FAILED] = IST("Total number of failed pool allocations."),
[INF_ULIMIT_N] = IST("Maximum number of open file descriptors; 0=unset."),
[INF_MAXSOCK] = IST("Maximum numer of open sockets."),
[INF_MAXCONN] = IST("Maximum number of concurrent connections."),
[INF_HARD_MAXCONN] = IST("Initial Maximum number of concurrent connections."),
[INF_CURR_CONN] = IST("Number of active sessions."),
- [INF_CUM_CONN] = IST("Total number of terminated sessions."),
+ [INF_CUM_CONN] = IST("Total number of created sessions."),
[INF_CUM_REQ] = IST("Total number of requests (TCP or HTTP)."),
[INF_MAX_SSL_CONNS] = IST("Configured maximum number of concurrent SSL connections."),
[INF_CURR_SSL_CONNS] = IST("Number of opened SSL connections."),
@@ -1240,16 +1240,16 @@
metric = mkf_u32(FO_KEY, relative_pid);
break;
case INF_UPTIME_SEC:
- metric = mkf_u32(FN_DURATION, (now.tv_sec - start_date.tv_sec));
+ metric = mkf_u32(FN_DURATION, start_date.tv_sec);
break;
case INF_MEMMAX_MB:
- metric = mkf_u32(FO_CONFIG|FN_LIMIT, global.rlimit_memmax);
+ metric = mkf_u64(FO_CONFIG|FN_LIMIT, global.rlimit_memmax * 1048576L);
break;
case INF_POOL_ALLOC_MB:
- metric = mkf_u32(0, (unsigned)(pool_total_allocated() / 1048576L));
+ metric = mkf_u64(0, pool_total_allocated());
break;
case INF_POOL_USED_MB:
- metric = mkf_u32(0, (unsigned)(pool_total_used() / 1048576L));
+ metric = mkf_u64(0, pool_total_used());
break;
case INF_POOL_FAILED:
metric = mkf_u32(FN_COUNTER, pool_total_failures());