diff --git a/doc/management.txt b/doc/management.txt index 73fda8974..d56a031a0 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -1994,7 +1994,7 @@ show fd [] that the output format may evolve over time so this output must not be parsed by tools designed to be durable. -show info [typed|json] +show info [typed|json] [desc] 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 @@ -2026,6 +2026,10 @@ show info [typed|json] ..::: + When "desc" is appended to the command, one extra colon followed by a quoted + string is appended with a description for the metric. At the time of writing, + this is only supported for the "typed" and default output formats. + Example : > show info @@ -2285,7 +2289,7 @@ show sess The special id "all" dumps the states of all sessions, which must be avoided as much as possible as it is highly CPU intensive and can take a lot of time. -show stat [{|} ] [typed|json] +show stat [{|} ] [typed|json] [desc] Dump statistics using the CSV format; using the extended typed output format described in the section above if "typed" is passed after the other arguments; or in JSON if "json" is passed after the other arguments @@ -2359,6 +2363,10 @@ show stat [{|} ] [typed|json] "str". Then the fourth column is the value itself, which the consumer knows how to parse thanks to column 3 and how to process thanks to column 2. + When "desc" is appended to the command, one extra colon followed by a quoted + string is appended with a description for the metric. At the time of writing, + this is only supported for the "typed" output format. + Thus the overall line format in typed mode is : .....::: diff --git a/src/stats.c b/src/stats.c index e9cbb9684..69fe9a8eb 100644 --- a/src/stats.c +++ b/src/stats.c @@ -544,6 +544,8 @@ static int stats_dump_fields_typed(struct buffer *out, return 0; if (!stats_emit_typed_data_field(out, &stats[field])) return 0; + if ((flags & STAT_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", stat_fields[field].desc)) + return 0; if (!chunk_strcat(out, "\n")) return 0; } @@ -3327,6 +3329,8 @@ static int stats_dump_info_fields(struct buffer *out, return 0; if (!stats_emit_raw_data_field(out, &info[field])) return 0; + if ((flags & STAT_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", info_fields[field].desc)) + return 0; if (!chunk_strcat(out, "\n")) return 0; } @@ -3349,6 +3353,8 @@ static int stats_dump_typed_info_fields(struct buffer *out, return 0; if (!stats_emit_typed_data_field(out, &info[field])) return 0; + if ((flags & STAT_SHOW_FDESC) && !chunk_appendf(out, ":\"%s\"", info_fields[field].desc)) + return 0; if (!chunk_strcat(out, "\n")) return 0; }