Explorar el Código

fix(tracing): remove internal extra field from the trace config

This commit removes the internal extra field from the trace config
structure exposed to the user via the HTTP API.
Kjell Winblad hace 1 año
padre
commit
2890bc2619

+ 3 - 4
apps/emqx/src/emqx_trace/emqx_trace.erl

@@ -255,11 +255,10 @@ format(Traces) ->
         fun(Trace0 = #?TRACE{}) ->
             [_ | Values] = tuple_to_list(Trace0),
             Map0 = maps:from_list(lists:zip(Fields, Values)),
-            Extra0 = maps:get(extra, Map0, #{}),
-            Formatter = maps:get(formatter, Extra0, text),
+            Extra = maps:get(extra, Map0, #{}),
+            Formatter = maps:get(formatter, Extra, text),
             Map1 = Map0#{formatter => Formatter},
-            Extra1 = maps:remove(formatter, Extra0),
-            maps:put(extra, Extra1, Map1)
+            maps:remove(extra, Map1)
         end,
         Traces
     ).

+ 0 - 1
apps/emqx/test/emqx_trace_SUITE.erl

@@ -96,7 +96,6 @@ t_base_create_delete(_Config) ->
             start_at => Now,
             end_at => Now + 30 * 60,
             payload_encode => text,
-            extra => #{},
             formatter => text
         }
     ],