MINOR: stats: support an optional "float" option to "show info"
This will allow some fields to be produced with a higher accuracy when the requester indicates being able to parse floats. Rates and times are among the elements which can make sense.
This commit is contained in:
parent
0b26b3866c
commit
2745620240
|
@ -2295,7 +2295,7 @@ show fd [<fd>]
|
|||
suffixed with an exclamation mark ('!'). This may help find a starting point
|
||||
when trying to diagnose an incident.
|
||||
|
||||
show info [typed|json] [desc]
|
||||
show info [typed|json] [desc] [float]
|
||||
Dump info about haproxy status on current process. If "typed" is passed as an
|
||||
optional argument, field numbers, names and types are emitted as well so that
|
||||
external monitoring products can easily retrieve, possibly aggregate, then
|
||||
|
@ -2306,7 +2306,11 @@ show info [typed|json] [desc]
|
|||
delimited by a colon (':'). The left one is the field name and the right
|
||||
one is the value. It is very important to note that in typed output
|
||||
format, the dump for a single object is contiguous so that there is no
|
||||
need for a consumer to store everything at once.
|
||||
need for a consumer to store everything at once. If "float" is passed as an
|
||||
optional argument, some fields usually emitted as integers may switch to
|
||||
floats for higher accuracy. It is purposely unspecified which ones are
|
||||
concerned as this might evolve over time. Using this option implies that the
|
||||
consumer is able to process floats. The output format used is sprintf("%f").
|
||||
|
||||
When using the typed output format, each line is made of 4 columns delimited
|
||||
by colons (':'). The first column is a dot-delimited series of 3 elements. The
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#define STAT_SHMODULES 0x00002000 /* conf: show modules */
|
||||
#define STAT_HIDE_MAINT 0x00004000 /* hide maint/disabled servers */
|
||||
#define STAT_CONVDONE 0x00008000 /* conf: rules conversion done */
|
||||
#define STAT_USE_FLOAT 0x00010000 /* use floats where possible in the outputs */
|
||||
|
||||
#define STAT_BOUND 0x00800000 /* bound statistics to selected proxies/types/services */
|
||||
#define STAT_STARTED 0x01000000 /* some output has occurred */
|
||||
|
|
|
@ -4788,6 +4788,8 @@ static int cli_parse_show_info(char **args, char *payload, struct appctx *appctx
|
|||
appctx->ctx.stats.flags = (appctx->ctx.stats.flags & ~STAT_FMT_MASK) | STAT_FMT_JSON;
|
||||
else if (strcmp(args[arg], "desc") == 0)
|
||||
appctx->ctx.stats.flags |= STAT_SHOW_FDESC;
|
||||
else if (strcmp(args[arg], "float") == 0)
|
||||
appctx->ctx.stats.flags |= STAT_USE_FLOAT;
|
||||
arg++;
|
||||
}
|
||||
return 0;
|
||||
|
@ -5111,7 +5113,7 @@ REGISTER_PER_THREAD_FREE(free_trash_counters);
|
|||
/* register cli keywords */
|
||||
static struct cli_kw_list cli_kws = {{ },{
|
||||
{ { "clear", "counters", NULL }, "clear counters [all] : clear max statistics counters (or all counters)", cli_parse_clear_counters, NULL, NULL },
|
||||
{ { "show", "info", NULL }, "show info [desc|json|typed]* : report information about the running process", cli_parse_show_info, cli_io_handler_dump_info, NULL },
|
||||
{ { "show", "info", NULL }, "show info [desc|json|typed|float]* : report information about the running process", cli_parse_show_info, cli_io_handler_dump_info, NULL },
|
||||
{ { "show", "stat", NULL }, "show stat [desc|json|no-maint|typed|up]*: report counters for each proxy and server", cli_parse_show_stat, cli_io_handler_dump_stat, NULL },
|
||||
{ { "show", "schema", "json", NULL }, "show schema json : report schema used for stats", NULL, cli_io_handler_dump_json_schema, NULL },
|
||||
{{},}
|
||||
|
|
Loading…
Reference in New Issue