Commit 7c687532 authored by Heinz N. Gies's avatar Heinz N. Gies
Browse files

Fix encoding for null metadata

parent 55a7d32f
......@@ -56,7 +56,7 @@ encode_reply(Start, T, R2) ->
R3 = [#{name => Name,
resolution => Resolution,
values => mmath_bin:to_list(Data),
metadata => Mdata,
metadata => maps:map(fun to_null/2, Mdata),
type => <<"metrics">>}
|| #{name := Name,
data := Data,
......@@ -64,7 +64,7 @@ encode_reply(Start, T, R2) ->
metadata := Mdata,
resolution := Resolution} <- R2],
R4 = [#{name => Name,
metadata => Mdata,
metadata => maps:map(fun to_null/2, Mdata),
values => [#{timestamp => Ts, event => E}
|| {Ts, E} <- Data],
type => <<"events">>}
......@@ -83,6 +83,11 @@ encode_reply(Start, T, R2) ->
D
end.
to_null(_, undefined) ->
null;
to_null(_, V) ->
V.
content_type(Req) ->
{ok, A, Req1} = cowboy_req:parse_header(<<"accept">>, Req),
{content_type_(A), Req1}.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment