diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index e6023d353..ee7c38f76 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -545,7 +545,7 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx) size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); int ret = 1; - if (!stats_fill_info(info, INF_TOTAL_FIELDS)) + if (!stats_fill_info(info, INF_TOTAL_FIELDS, 0)) return -1; for (; appctx->st2 < INF_TOTAL_FIELDS; appctx->st2++) { diff --git a/include/haproxy/stats.h b/include/haproxy/stats.h index a97740d28..bdb9c076c 100644 --- a/include/haproxy/stats.h +++ b/include/haproxy/stats.h @@ -45,7 +45,7 @@ int stats_putchk(struct channel *chn, struct htx *htx, struct buffer *chk); int stats_dump_one_line(const struct field *stats, size_t stats_count, struct appctx *appctx); -int stats_fill_info(struct field *info, int len); +int stats_fill_info(struct field *info, int len, uint flags); int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len, enum stat_field *selected_field); int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags, diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index 46a807e58..26aa50984 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -356,7 +356,7 @@ static int hlua_get_info(lua_State *L) { int i; - stats_fill_info(stats, STATS_LEN); + stats_fill_info(stats, STATS_LEN, 0); lua_newtable(L); for (i=0; i with HAProxy global info. is preallocated - * array of length . The length of the array must be - * INF_TOTAL_FIELDS. If this length is less then this value, the - * function returns 0, otherwise, it returns 1. +/* Fill with HAProxy global info. is preallocated array of length + * . The length of the array must be INF_TOTAL_FIELDS. If this length is + * less then this value, the function returns 0, otherwise, it returns 1. Some + * fields' presence or precision may depend on some of the STAT_* flags present + * in . */ -int stats_fill_info(struct field *info, int len) +int stats_fill_info(struct field *info, int len, uint flags) { unsigned int up = (now.tv_sec - start_date.tv_sec); struct buffer *out = get_trash_chunk(); @@ -4410,7 +4411,7 @@ static int stats_dump_info_to_buffer(struct stream_interface *si) { struct appctx *appctx = __objt_appctx(si->end); - if (!stats_fill_info(info, INF_TOTAL_FIELDS)) + if (!stats_fill_info(info, INF_TOTAL_FIELDS, appctx->ctx.stats.flags)) return 0; chunk_reset(&trash);