]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: raw_sock: Report the number of bytes emitted using the splicing
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 10 Jul 2020 11:56:30 +0000 (13:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 15 Jul 2020 12:08:14 +0000 (14:08 +0200)
In the continuity of the commit 7cf0e4517 ("MINOR: raw_sock: report global
traffic statistics"), we are now able to report the global number of bytes
emitted using the splicing. It can be retrieved in "show info" output on the
CLI.

Note this counter is always declared, regardless the splicing support. This
eases the integration with monitoring tools plugged on the CLI.

include/haproxy/global-t.h
include/haproxy/stats-t.h
src/raw_sock.c
src/stats.c

index 677d98f51a34972b74358dc1440f33566b12edea..8acba890b34a4b876ab262b3c962a02f44710258 100644 (file)
@@ -109,6 +109,7 @@ struct global {
        struct freq_ctr comp_bps_out;   /* bytes per second, after http compression */
        struct freq_ctr out_32bps;      /* #of 32-byte blocks emitted per second */
        unsigned long long out_bytes;   /* total #of bytes emitted */
+       unsigned long long spliced_out_bytes; /* total #of bytes emitted though a kernel pipe */
        int cps_lim, cps_max;
        int sps_lim, sps_max;
        int ssl_lim, ssl_max;
index 01c399d88100494b7d225ffa4ea63396ded75cc6..baf2fac5d0cde2024a8538dd762135c78a1ada33 100644 (file)
@@ -314,6 +314,7 @@ enum info_field {
        INF_BUSY_POLLING,
        INF_FAILED_RESOLUTIONS,
        INF_TOTAL_BYTES_OUT,
+       INF_TOTAL_SPLICED_BYTES_OUT,
        INF_BYTES_OUT_RATE,
        INF_DEBUG_COMMANDS_ISSUED,
 
index 2d31b185130d5be45685c76870b09a838b8e7700..1900a5c4a86d76a70cc5b303bb7254c8208e1266 100644 (file)
@@ -154,6 +154,7 @@ int raw_sock_to_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe,
                 * limited to 4GB and that it's not enough per second.
                 */
                _HA_ATOMIC_ADD(&global.out_bytes, retval);
+               _HA_ATOMIC_ADD(&global.spliced_out_bytes, retval);
                update_freq_ctr(&global.out_32bps, (retval + 16) / 32);
        }
        return retval;
index 1a453c39849a67f3ccb0091078fef4ae4a6eee23..e8ea831a7e6c982cddc1c568c8d0d4aacbcb4729 100644 (file)
@@ -144,6 +144,7 @@ const struct name_desc info_fields[INF_TOTAL_FIELDS] = {
        [INF_BUSY_POLLING]                   = { .name = "BusyPolling",                 .desc = "1 if busy-polling is currently in use on the worker process, otherwise zero (config.busy-polling)" },
        [INF_FAILED_RESOLUTIONS]             = { .name = "FailedResolutions",           .desc = "Total number of failed DNS resolutions in current worker process since started" },
        [INF_TOTAL_BYTES_OUT]                = { .name = "TotalBytesOut",               .desc = "Total number of bytes emitted by current worker process since started" },
+       [INF_TOTAL_SPLICED_BYTES_OUT]        = { .name = "TotalSplicdedBytesOut",       .desc = "Total number of bytes emitted by current worker process through a kernel pipe since started" },
        [INF_BYTES_OUT_RATE]                 = { .name = "BytesOutRate",                .desc = "Number of bytes emitted by current worker process over the last second" },
        [INF_DEBUG_COMMANDS_ISSUED]          = { .name = "DebugCommandsIssued",         .desc = "Number of debug commands issued on this process (anything > 0 is unsafe)" },
 };
@@ -3519,6 +3520,7 @@ int stats_fill_info(struct field *info, int len)
        info[INF_BUSY_POLLING]                   = mkf_u32(0, !!(global.tune.options & GTUNE_BUSY_POLLING));
        info[INF_FAILED_RESOLUTIONS]             = mkf_u32(0, dns_failed_resolutions);
        info[INF_TOTAL_BYTES_OUT]                = mkf_u64(0, global.out_bytes);
+       info[INF_TOTAL_SPLICED_BYTES_OUT]        = mkf_u64(0, global.spliced_out_bytes);
        info[INF_BYTES_OUT_RATE]                 = mkf_u64(FN_RATE, (unsigned long long)read_freq_ctr(&global.out_32bps) * 32);
        info[INF_DEBUG_COMMANDS_ISSUED]          = mkf_u32(0, debug_commands_issued);