BUG/MINOR: Fix prometheus '# TYPE' and '# HELP' headers

Prometheus protocol defines HELP and TYPE as a token after the '#' and
the space after the '#' is necessary.
This is expected in the prometheus python client for example
(a8f5c80f65/prometheus_client/parser.py (L194))
and the missing space is breaking the parsing of metrics' type.

This patch must be backported to 2.0.
This commit is contained in:
Anthonin Bonnefoy 2019-08-07 17:45:25 +02:00 committed by Christopher Faulet
parent 579e3e3dd5
commit 51c3aa4628
1 changed files with 2 additions and 2 deletions

View File

@ -1126,11 +1126,11 @@ static int promex_dump_metric_header(struct appctx *appctx, struct htx *htx,
types = promex_st_metric_types;
}
if (istcat(out, ist("#HELP "), max) == -1 ||
if (istcat(out, ist("# HELP "), max) == -1 ||
istcat(out, name, max) == -1 ||
istcat(out, ist(" "), max) == -1 ||
istcat(out, desc[appctx->st2], max) == -1 ||
istcat(out, ist("\n#TYPE "), max) == -1 ||
istcat(out, ist("\n# TYPE "), max) == -1 ||
istcat(out, name, max) == -1 ||
istcat(out, ist(" "), max) == -1 ||
istcat(out, types[appctx->st2], max) == -1 ||