mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-26 15:40:32 +00:00
MINOR: stats: pass the appctx flags to stats_fill_info()
Currently the stats filling function knows nothing about the caller's needs, so let's pass the STAT_* flags so that it can adapt to the requester's constraints.
This commit is contained in:
parent
6004fb7681
commit
0b26b3866c
@ -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++) {
|
||||
|
@ -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,
|
||||
|
@ -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<INF_TOTAL_FIELDS; i++) {
|
||||
|
13
src/stats.c
13
src/stats.c
@ -4285,12 +4285,13 @@ static int stats_dump_typed_info_fields(struct buffer *out,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Fill <info> with HAProxy global info. <info> is preallocated
|
||||
* array of length <len>. 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 <info> with HAProxy global info. <info> is preallocated array of length
|
||||
* <len>. 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 <flags>.
|
||||
*/
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user