]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: promex: test applet resume in stress mode
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 24 Feb 2026 16:05:37 +0000 (17:05 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 26 Feb 2026 17:24:36 +0000 (18:24 +0100)
Implement a stress mode with force yield for promex applet each time a
metric is displayed. This is implemented by returning 0 in
promex_dump_ts() each time the output buffer is not empty.

To test this, haproxy must be compiled with DEBUG_STRESS and the
following configuration must be used :

  global
    stress-level 1

addons/promex/service-prometheus.c

index 0cd5a6c0fe20ef13d886e76e323b772f293f5cf4..a09fa8730d46f3a7902086d42c01cb421f7de83b 100644 (file)
@@ -36,6 +36,7 @@
 #include <haproxy/stats.h>
 #include <haproxy/stconn.h>
 #include <haproxy/stream.h>
+#include <haproxy/stress.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 #include <haproxy/version.h>
@@ -347,6 +348,10 @@ static int promex_dump_ts(struct appctx *appctx, struct ist prefix,
        istcat(&n, prefix, PROMEX_MAX_NAME_LEN);
        istcat(&n, name, PROMEX_MAX_NAME_LEN);
 
+       /* In stress mode, force yielding on each metric. */
+       if (STRESS_RUN1(istlen(*out), 0))
+               goto full;
+
        if ((ctx->flags & PROMEX_FL_METRIC_HDR) &&
            !promex_dump_ts_header(n, desc, type, out, max))
                goto full;