Skip to content

Commit 29d7771

Browse files
committed
prometheus_text_format: Fix argument order for format_into/3 fun
The formatting function should take the state as the first argument and new data as the second. See `format/1` which passes in the trailing linefeed as the second argument. This doesn't make much difference when calling `format/1` because the swapped arguments only caused the metrics to be concatenated in reverse. But this fix is important for using `format_into/3` correctly, for example with `cowboy_req:stream_body/3`.
1 parent 566e985 commit 29d7771

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/formats/prometheus_text_format.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ format_into_create_mf_callback_fn(Fmt) ->
101101
"\n"
102102
>>,
103103
Bin = render_metrics(Prologue, Name, Metrics),
104-
put(?MODULE, Fmt(Bin, erase(?MODULE)))
104+
put(?MODULE, Fmt(erase(?MODULE), Bin))
105105
end.
106106

107107
?DOC("""

0 commit comments

Comments
 (0)