]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: contrib/prometheus-exporter: Export internal errors per proxy/server
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 16 Dec 2019 13:44:01 +0000 (14:44 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 20 Jan 2020 14:18:45 +0000 (15:18 +0100)
The new ST_F_EINT stats field is now exported for each proxy/server.

contrib/prometheus-exporter/README
contrib/prometheus-exporter/service-prometheus.c

index a9bd5e7a39a1677c476d8efeeb29eac01e049158..a0df4b21de44888a7b017094c6e36a3125bee23c 100644 (file)
@@ -178,6 +178,7 @@ Exported metrics
 | haproxy_frontend_http_comp_bytes_out_total      | Total number of HTTP response bytes emitted by the compressor.               |
 | haproxy_frontend_http_comp_bytes_bypassed_total | Total number of bytes that bypassed the HTTP compressor (CPU/BW limit).      |
 | haproxy_frontend_http_comp_responses_total      | Total number of HTTP responses that were compressed.                         |
+| haproxy_frontend_internal_errors_total          | Total number of internal errors.                                             |
 +-------------------------------------------------+------------------------------------------------------------------------------+
 
 * Backend metrics
@@ -230,6 +231,7 @@ Exported metrics
 | haproxy_backend_http_comp_bytes_out_total           | Total number of HTTP response bytes emitted by the compressor.           |
 | haproxy_backend_http_comp_bytes_bypassed_total      | Total number of bytes that bypassed the HTTP compressor (CPU/BW limit).  |
 | haproxy_backend_http_comp_responses_total           | Total number of HTTP responses that were compressed.                     |
+| haproxy_backend_internal_errors_total               | Total number of internal errors.                                         |
 +-----------------------------------------------------+--------------------------------------------------------------------------+
 
 * Server metrics
@@ -279,6 +281,7 @@ Exported metrics
 | haproxy_server_http_responses_total                | Total number of HTTP responses.                                           |
 | haproxy_server_idle_connections_current            | Current number of idle connections available for reuse.                   |
 | haproxy_server_idle_connections_limit              | Limit on the number of available idle connections.                        |
+| haproxy_server_internal_errors_total               | Total number of internal errors.                                          |
 +----------------------------------------------------+---------------------------------------------------------------------------+
 
 Mapping of health check status :
index 4cf216a23aa7dfe5d5d257700af564ab6a1de794..6b828f46cfe6d7db8eeb4deb0531421d7407861c 100644 (file)
@@ -234,7 +234,7 @@ const int promex_front_metrics[ST_F_TOTAL_FIELDS] = {
        [ST_F_INTERCEPTED]    = ST_F_CACHE_LOOKUPS,
        [ST_F_DCON]           = ST_F_DSES,
        [ST_F_DSES]           = ST_F_WREW,
-       [ST_F_WREW]           = ST_F_REQ_RATE_MAX,
+       [ST_F_WREW]           = ST_F_EINT,
        [ST_F_CONNECT]        = 0,
        [ST_F_REUSE]          = 0,
        [ST_F_CACHE_LOOKUPS]  = ST_F_CACHE_HITS,
@@ -245,6 +245,7 @@ const int promex_front_metrics[ST_F_TOTAL_FIELDS] = {
        [ST_F_CT_MAX]         = 0,
        [ST_F_RT_MAX]         = 0,
        [ST_F_TT_MAX]         = 0,
+       [ST_F_EINT]           = ST_F_REQ_RATE_MAX,
 };
 
 /* Matrix used to dump backend metrics. Each metric points to the next one to be
@@ -333,7 +334,7 @@ const int promex_back_metrics[ST_F_TOTAL_FIELDS] = {
        [ST_F_INTERCEPTED]    = 0,
        [ST_F_DCON]           = 0,
        [ST_F_DSES]           = 0,
-       [ST_F_WREW]           = ST_F_CLI_ABRT,
+       [ST_F_WREW]           = ST_F_EINT,
        [ST_F_CONNECT]        = ST_F_REUSE,
        [ST_F_REUSE]          = ST_F_BIN,
        [ST_F_CACHE_LOOKUPS]  = ST_F_CACHE_HITS,
@@ -344,6 +345,7 @@ const int promex_back_metrics[ST_F_TOTAL_FIELDS] = {
        [ST_F_CT_MAX]         = ST_F_RT_MAX,
        [ST_F_RT_MAX]         = ST_F_TT_MAX,
        [ST_F_TT_MAX]         = ST_F_DREQ,
+       [ST_F_EINT]           = ST_F_CLI_ABRT,
 };
 
 /* Matrix used to dump server metrics. Each metric points to the next one to be
@@ -432,7 +434,7 @@ const int promex_srv_metrics[ST_F_TOTAL_FIELDS] = {
        [ST_F_INTERCEPTED]    = 0,
        [ST_F_DCON]           = 0,
        [ST_F_DSES]           = 0,
-       [ST_F_WREW]           = ST_F_CLI_ABRT,
+       [ST_F_WREW]           = ST_F_EINT,
        [ST_F_CONNECT]        = ST_F_REUSE,
        [ST_F_REUSE]          = ST_F_DRESP,
        [ST_F_CACHE_LOOKUPS]  = 0,
@@ -443,6 +445,7 @@ const int promex_srv_metrics[ST_F_TOTAL_FIELDS] = {
        [ST_F_CT_MAX]         = ST_F_RT_MAX,
        [ST_F_RT_MAX]         = ST_F_TT_MAX,
        [ST_F_TT_MAX]         = ST_F_CONNECT,
+       [ST_F_EINT]           = ST_F_CLI_ABRT,
 };
 
 /* Name of all info fields */
@@ -605,6 +608,7 @@ const struct ist promex_st_metric_names[ST_F_TOTAL_FIELDS] = {
        [ST_F_CT_MAX]         = IST("max_connect_time_seconds"),
        [ST_F_RT_MAX]         = IST("max_response_time_seconds"),
        [ST_F_TT_MAX]         = IST("max_total_time_seconds"),
+       [ST_F_EINT]           = IST("internal_errors_total"),
 };
 
 /* Description of all info fields */
@@ -767,6 +771,7 @@ const struct ist promex_st_metric_desc[ST_F_TOTAL_FIELDS] = {
        [ST_F_CT_MAX]         = IST("Maximum observed time spent waiting for a connection to complete"),
        [ST_F_RT_MAX]         = IST("Maximum observed time spent waiting for a server response"),
        [ST_F_TT_MAX]         = IST("Maximum observed total request+response time (request+queue+connect+response+processing)"),
+       [ST_F_EINT]           = IST("Total number of internal errors."),
 };
 
 /* Specific labels for all info fields. Empty by default. */
@@ -1085,6 +1090,7 @@ const struct ist promex_st_metric_types[ST_F_TOTAL_FIELDS] = {
        [ST_F_CT_MAX]         = IST("gauge"),
        [ST_F_RT_MAX]         = IST("gauge"),
        [ST_F_TT_MAX]         = IST("gauge"),
+       [ST_F_EINT]           = IST("counter"),
 };
 
 /* Return the server status: 0=DOWN, 1=UP, 2=MAINT, 3=DRAIN, 4=NOLB. */
@@ -1531,6 +1537,9 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
                                case ST_F_WREW:
                                        metric = mkf_u64(FN_COUNTER, px->fe_counters.failed_rewrites);
                                        break;
+                               case ST_F_EINT:
+                                       metric = mkf_u64(FN_COUNTER, px->fe_counters.internal_errors);
+                                       break;
                                case ST_F_REQ_RATE_MAX:
                                        if (px->mode != PR_MODE_HTTP)
                                                goto next_px;
@@ -1754,6 +1763,9 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
                                case ST_F_WREW:
                                        metric = mkf_u64(FN_COUNTER, px->be_counters.failed_rewrites);
                                        break;
+                               case ST_F_EINT:
+                                       metric = mkf_u64(FN_COUNTER, px->be_counters.internal_errors);
+                                       break;
                                case ST_F_CLI_ABRT:
                                        metric = mkf_u64(FN_COUNTER, px->be_counters.cli_aborts);
                                        break;
@@ -2002,6 +2014,9 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
                                        case ST_F_WREW:
                                                metric = mkf_u64(FN_COUNTER, sv->counters.failed_rewrites);
                                                break;
+                                       case ST_F_EINT:
+                                               metric = mkf_u64(FN_COUNTER, sv->counters.internal_errors);
+                                               break;
                                        case ST_F_CLI_ABRT:
                                                metric = mkf_u64(FN_COUNTER, sv->counters.cli_aborts);
                                                break;