anchor.diff:      ].
   
   
  -append_metrics_test_() ->
  -    [?_assertEqual(#{"foo" => [1]}, append_metrics("foo", 1, #{})),
  -     ?_assertEqual(#{"foo" => [2, 1]}, append_metrics("foo", 2, #{"foo" => [1]})),
  -     ?_assertEqual(#{"foo" => [8, 1], "bar" => 34}, append_metrics("foo", 8, #{"foo" => [1], "bar" => 34})),
  -     ?_assertEqual(#{"foo" => 9}, append_metrics("foo", 9, #{"foo" => 9}))
  +record_metrics_test_() ->
  +    [?_assertEqual(#{"foo" => [1]}, record_metrics("foo", 1, #{})),
  +     ?_assertEqual(#{"foo" => [2, 1]}, record_metrics("foo", 2, #{"foo" => [1]})),
  +     ?_assertEqual(#{"foo" => [8, 1], "bar" => 34}, record_metrics("foo", 8, #{"foo" => [1], "bar" => 34})),
  +     ?_assertEqual(#{"foo" => 9}, record_metrics("foo", 9, #{"foo" => 9}))
       ].
   
   
  
positive.code:     Map = increment_metrics(Key, Amount, State#state.metrics),
      {noreply, State#state{metrics=Map}};
  
  handle_cast({append, Key, Value}, State) ->
      Map = append_metrics(Key, Value, State#state.metrics),
      {noreply, State#state{metrics=Map}};
  
  handle_cast(_Msg, State) ->
  
negative.code:     Metrics = State#state.metrics,
      lager:debug("instrumentation: handle metrics update - current ~p", [Metrics]),
  
      UpdatedM = maps:fold(fun(K, V, Map) when is_number(V) ->
                                   publish(K, V, Now, Path),
                                   maps:put(K, 0, Map);
                              (K, Vs, Map) when is_list(Vs) ->
                                   Avg = statser_calc:safe_average(Vs),
                                   publish(K, Avg, Now, Path),
                                   maps:put(K, [], Map);
                              (_K, _V, Map) -> Map
                           end, Metrics, Metrics),
  
  