]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sink: add processed events counter in sft
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 22 Jul 2024 13:24:26 +0000 (15:24 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 24 Jul 2024 15:59:08 +0000 (17:59 +0200)
Add a new struct member to sft structure named e_processed in order to
track the total number of events processed by sft applets.

sink_forward_oc_io_handler() and sink_forward_io_handler() now make use
of ring_dispatch_messages() optional value added in the previous commit
in order to increase the number of processed events.

include/haproxy/sink-t.h
src/sink.c

index d5e1cec57db0cf685d203c099b13e683afacf625..990aa72d661ba5ae106a4f83e05db58c20f41720 100644 (file)
@@ -40,6 +40,7 @@ struct sink_forward_target {
        struct server *srv;    // used server
        struct appctx *appctx; // appctx of current session
        size_t ofs;            // ring buffer reader offset
+       size_t e_processed;    // processed events
        struct sink *sink;     // the associated sink
        struct sink_forward_target *next;
        __decl_thread(HA_SPINLOCK_T lock); // lock to protect current struct
index 29b68a0189244d11681e53556986bb76b13a4998..16597b2111d9f00427aaca1d9ebfc2c9db2a9a61 100644 (file)
@@ -353,6 +353,7 @@ static void _sink_forward_io_handler(struct appctx *appctx,
        struct sink *sink = sft->sink;
        struct ring *ring = sink->ctx.ring;
        size_t ofs, last_ofs;
+       size_t processed;
        int ret = 0;
 
        if (unlikely(se_fl_test(appctx->sedesc, (SE_FL_EOS|SE_FL_ERROR)))) {
@@ -383,7 +384,8 @@ static void _sink_forward_io_handler(struct appctx *appctx,
        MT_LIST_DELETE(&appctx->wait_entry);
 
        ret = ring_dispatch_messages(ring, appctx, &sft->ofs, &last_ofs, 0,
-                                    msg_handler, NULL);
+                                    msg_handler, &processed);
+       sft->e_processed += processed;
 
        if (ret) {
                /* let's be woken up once new data arrive */