anchor.diff:           get_udp_config/0,
            get_data_dir/0,
            get_metric_filters/0,
  +         metric_passes_filters/2,
            udp_is_enabled/1]).
   
   
  
positive.code:     application:get_env(statser, data_dir, ?FALLBACK_METRICS_DATA_DIR).
  
  
  %%%===================================================================
  %%% Internal functions
  %%%===================================================================
  
  first_or_fallback(_GetPattern, Fallback, _Path, []) -> Fallback;
  first_or_fallback(GetPattern, Fallback, Path, [C | Cs]) ->
  
negative.code:                       }], parse_retentions(["1h:1y"]))
      ].
  
  
  to_filters(WhiteList, BlackList) ->
      ToPattern = fun(Pattern) ->
                          {ok, Pat} = re:compile(Pattern, [no_auto_capture]),
                          #metric_pattern{pattern=Pat}
                  end,
      #metric_filters{whitelist=lists:map(ToPattern, WhiteList),
                      blacklist=lists:map(ToPattern, BlackList)}.
  
  
  metric_passes_filters_test_() ->
      [?_assertEqual(true, metric_passes_filters(<<"foo.bar">>, to_filters([], []))),
       ?_assertEqual(true, metric_passes_filters(<<"foo.bar">>, to_filters(["^foo\."], []))),
       ?_assertEqual(true, metric_passes_filters(<<"foo.bar">>, to_filters(["\.bar$"], []))),
       ?_assertEqual(true, metric_passes_filters(<<"foo.bar">>, to_filters(["ba"], []))),
       ?_assertEqual(true, metric_passes_filters(<<"foo.bar">>, to_filters(["^bar", "bar"], []))),
       ?_assertEqual(true, metric_passes_filters(<<"foo.bar">>, to_filters(["^foo"], ["^stats"]))),
       ?_assertEqual(false, metric_passes_filters(<<"foo.bar">>, to_filters(["^bar\."], []))),
       ?_assertEqual(false, metric_passes_filters(<<"foo.bar">>, to_filters(["^foo"], ["bar$"]))),
       ?_assertEqual(false, metric_passes_filters(<<"foo.bar">>, to_filters([], ["bar$"]))),
       ?_assertEqual(true, metric_passes_filters(<<"foo.bar">>, to_filters([], ["foo$"]))),
       ?_assertEqual(false, metric_passes_filters(<<"foo.bar">>, to_filters([], ["foo$", "foo"])))
      ].
  
  -endif. % TEST
  