]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: contrib/prometheus-exporter: Add HTX data block in one time
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 May 2019 19:56:07 +0000 (21:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Jun 2019 08:12:11 +0000 (10:12 +0200)
Since recent changes on the way HTX data blocks are added in an HTX message, we
must now be sure the prometheus service add its own blocks in one time. Indeed,
the function htx_add_data() may now decide to only copy a part of data. So
instead, we must call htx_add_data_atonce() instead.

contrib/prometheus-exporter/service-prometheus.c

index 3071b8f0fe686cfed4a21d52cab55f6575c2ecff..483e7031f18c16d009ab2696d296f358fedaecc7 100644 (file)
@@ -1409,7 +1409,7 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx)
        }
 
   end:
-       if (!htx_add_data(htx, out))
+       if (!htx_add_data_atonce(htx, out))
                return -1; /* Unexpected and unrecoverable error */
        channel_add_input(chn, out.len);
        return ret;
@@ -1587,7 +1587,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
        }
 
   end:
-       if (!htx_add_data(htx, out))
+       if (!htx_add_data_atonce(htx, out))
                return -1; /* Unexpected and unrecoverable error */
        channel_add_input(chn, out.len);
        return ret;
@@ -1805,7 +1805,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
        }
 
   end:
-       if (!htx_add_data(htx, out))
+       if (!htx_add_data_atonce(htx, out))
                return -1; /* Unexpected and unrecoverable error */
        channel_add_input(chn, out.len);
        return ret;
@@ -1999,7 +1999,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
 
 
   end:
-       if (!htx_add_data(htx, out))
+       if (!htx_add_data_atonce(htx, out))
                return -1; /* Unexpected and unrecoverable error */
        channel_add_input(chn, out.len);
        return ret;