anchor.diff:  parse_body({_Length, Body}) ->
       try
           Lines = binary:split(Body, <<"\n">>, [global]),
  -        [ parse_line(L) || L <- Lines, L =/= <<>> ]
  +        [ parse_metric(L) || L <- Lines, L =/= <<>> ]
       catch
           error:Why ->
               error_logger:error_report({bad_metric,
  
positive.code:     
      end.
  
  parse_line(Bin) ->
      [Key, Value, Type | Rate] = binary:split(Bin, [<<":">>, <<"|">>], [global]),
      #shp_metric{key = Key, value = ?to_int(Value), type = parse_type(Type),
                 sample_rate = parse_sample_rate(Rate)}.
  
  parse_type(<<"m">>) ->
      m;
  
negative.code:        end
        },
  
        {"parse_metric valid metric tests",
         generator,
         fun() ->
                 Tests = [{<<"label:1|m">>,
                           #shp_metric{key = <<"label">>, value = 1, type = 'm'}},
  
                          {<<"label:123|h">>,
                           #shp_metric{key = <<"label">>, value = 123,
                                       type = 'h'}},
  
                          {<<"x:-123|g">>,
                           #shp_metric{key = <<"x">>, value = -123, type = 'g'}},
  
  
                          {<<"x:123|h">>,
                           #shp_metric{key = <<"x">>, value = 123, type = 'h'}},
  
                          % sample rate
                          {<<"x:123|h|@0.43">>,
                           #shp_metric{key = <<"x">>, value = 123, type = 'h',
                                       sample_rate = 0.43}}
                         ],
                 [ ?_assertEqual(Expect, parse_metric(In)) ||
                    {In, Expect} <- Tests ]
         end
        },
  