On Tue, Nov 29, 2016 at 08:12:28AM +0100, Willy Tarreau wrote:
> So here are a few comments about typos I noticed (irrelevant parts trimmed).
>
> > diff --git a/doc/management.txt b/doc/management.txt
> > index 4934c575a543..0592fc2da287 100644
> > --- a/doc/management.txt
> > +++ b/doc/management.txt
> > @@ -2220,6 +2234,21 @@ show tls-keys [id|*]
> > specified as parameter, it will dump the tickets, using * it will dump
> > every
> > keys from every references.
> >
> > +show schema json
> > + Dump the schema used for the output of "show info json" and "show stat
> > json".
> > +
> > + The contains no extra whitespace in order to reduce the volume of output.
> > + For human consumption passing the output through a pretty printer may be
> > + helpful. Example :
> > +
> > + $ echo "show schema json" | socat /var/run/haproxy.sock stdio | \
> > + python -m json.tool
> > +
> > + The schema follows "JSON Svhema" (json-schema.org) and accordingly
>
> s/Svhema/Schema/
>
> > diff --git a/src/stats.c b/src/stats.c
> > index 8c0e3d688cc8..808ac96da2d9 100644
> > --- a/src/stats.c
> > +++ b/src/stats.c
> > @@ -3262,6 +3262,218 @@ static int stats_dump_info_to_buffer(struct
> > stream_interface *si)
> (...)
>
> > + "\"tags\":{"
> > + "\"type\":\"object\","
> > + "\"origin\":{"
> > + "\"type\":\"string\","
> > + "\"enum\":[\"Metric\",\"Satus\",\"Key\",\"Config\","
>
> s/Satus/Status/
>
> > + "\"Product\",""\"Unknown\"]"
> > + "},"
> > + "\"nature\":{"
> > + "\"type\":\"string\","
> > + "\"enum\":[\"Gague\",\"Limit\",\"Min\",\"Max\","
>
> s/Gague/Gauge/
Thanks, I'll fix the typos you highlighted above.
> (...)
> > + "\"value\":{"
> > + "\"type\":\"integer\","
> > + "\"minimum\":0,"
> > + "\"maximum\":18446744073709551615"
>
> That reminds me and old discussion going back to the websocket design
> discussions. Someone said that in java and javascript ints are necessarily
> signed and the largest positive number that can be represented is 2^63-1.
> It might be worth checking if the value above is properly parsed by
> utilities written in such languages or if we'd rather cap it to half of
> its range (anyway we're not expecting to reach 2^63 bytes more often than
> 2^64), it requires 23 years of traffic at 100 Gbps to have that high a
> byte count instead of 46 years, so we have some margin.
I agree this could be a sticky point. I believe the limits are left up
to the implementation. But I'll do a bit of research and see if I can find
a better number.
> > +static int cli_parse_show_schema(char **args, struct appctx *appctx, void
> > *private)
> > +{
> > + if (strcmp(args[2], "json") == 0) {
> > + appctx->ctx.stats.flags |= STAT_FMT_JSON;
> > + } else {
> > + appctx->ctx.cli.msg = "json parameter missing.\n";
> > + appctx->st0 = CLI_ST_PRINT;
> > + return 1;
> > + }
> > +
> > + return 0;
> > +}
>
> You can even simplify this one by registering "show", "schema", "json" at
> once as I don't think we'll have any other schema for a while. But it's
> just a matter of taste, I personally have no preference.
Your suggestion sounds more like what I was after. I'll see if I can make
it so.
--
Simon Horman [email protected]
Horms Solutions BV www.horms.nl
Parnassusweg 819, 1082 LZ Amsterdam, Netherlands
Tel: +31 (0)20 800 6155 Skype: horms7