Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Fixing a stupid bug from my previous PR
Browse files Browse the repository at this point in the history
Added unit tests to make sure it won't happen again... Sorry!
  • Loading branch information
wk8 authored and JoshRagem committed Jan 13, 2017
1 parent 1d83ac6 commit c39a879
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/dogstatsd.erl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ normalize_metric_data({Name, Value}) ->
normalize_metric_data({Name, Value, SampleRate}) when is_number(SampleRate) ->
{Name, Value, SampleRate, #{}};
normalize_metric_data({Name, Value, Tags}) when is_map(Tags) ->
{Name, Value, 1.0, #{}};
{Name, Value, 1.0, Tags};
normalize_metric_data({_Name, _Value, _SampleRate, _Tags} = AlreadyNormalized) ->
AlreadyNormalized.

Expand Down Expand Up @@ -186,4 +186,14 @@ gauge_test_() ->
{"foo.bar", 1, "hello"}]))
]}.

normalize_metric_data_test_() ->
[
?_assertEqual({"key", "value", 1.0, #{}}, normalize_metric_data({"key", "value"}))
,?_assertEqual({"key", "value", 12, #{}}, normalize_metric_data({"key", "value", 12}))
,?_assertEqual({"key", "value", 1.0, #{foo => bar}},
normalize_metric_data({"key", "value", #{foo => bar}}))
,?_assertEqual({"key", "value", 12, #{foo => bar}},
normalize_metric_data({"key", "value", 12, #{foo => bar}}))
].

-endif.

0 comments on commit c39a879

Please sign in to comment.