Permalink
Browse files

WHISTLE-1412: Reworking how whistle_stats (& folsom) interacts with t…

…he system
  • Loading branch information...
1 parent 1fcf3c9 commit 07df298807deaf4edbf1bcc3cabdb882fe05f64e Jon Blanton committed Sep 17, 2012
@@ -119,30 +119,36 @@ maybe_delete_counter(Name) ->
-spec init_counter/2 :: (ne_binary(), integer()) -> ok.
init_counter(Name, Value) when Value > 0 ->
- folsom_metrics:new_counter(Name),
+ %folsom_metrics:new_counter(Name),
inc_counter(Name, Value);
init_counter(Name, Value) when Value < 0 ->
- folsom_metrics:new_counter(Name),
+ %folsom_metrics:new_counter(Name),
dec_counter(Name, Value * -1);
init_counter(Name, 0) ->
- folsom_metrics:new_counter(Name).
+ %folsom_metrics:new_counter(Name).
+ ok.
-spec inc_counter/2 :: (ne_binary(), integer()) -> ok.
inc_counter(Name, Value) ->
- folsom_metrics:notify({Name, {inc, Value}}).
+ %folsom_metrics:notify({Name, {inc, Value}}).
+ 0.
-spec dec_counter/2 :: (ne_binary(), integer()) -> ok.
dec_counter(Name, Value) ->
- folsom_metrics:notify({Name, {dec, Value}}).
+ %folsom_metrics:notify({Name, {dec, Value}}).
+ 0.
-spec get_counter/1 :: (ne_binary()) -> integer().
get_counter(Name) ->
- folsom_metrics:get_metric_value(Name).
+ %folsom_metrics:get_metric_value(Name).
+ 0.
-spec delete_counter/1 :: (ne_binary()) -> ok.
delete_counter(Name) ->
- folsom_metrics:delete_metric(Name).
+ %folsom_metrics:delete_metric(Name).
+ ok.
-spec counter_exists/1 :: (ne_binary()) -> true | false.
counter_exists(Name) ->
- folsom_metrics:metric_exists(Name).
+ %folsom_metrics:metric_exists(Name).
+ true.
@@ -105,21 +105,25 @@ maybe_delete_gauge(Name) ->
-spec init_gauge/2 :: (ne_binary(), gauge()) -> ok.
init_gauge(Name, Value) ->
- folsom_metrics:new_gauge(Name),
+ %folsom_metrics:new_gauge(Name),
set_gauge(Name, Value).
-spec set_gauge/2 :: (ne_binary(), gauge()) -> ok.
set_gauge(Name, Value) ->
- folsom_metrics:notify({Name, Value}).
+ %folsom_metrics:notify({Name, Value}).
+ ok.
-spec get_gauge/1 :: (ne_binary()) -> gauge().
get_gauge(Name) ->
- folsom_metrics:get_metric_value(Name).
+ %folsom_metrics:get_metric_value(Name).
+ 0.
-spec delete_gauge/1 :: (ne_binary()) -> ok.
delete_gauge(Name) ->
- folsom_metrics:delete_metric(Name).
+ %folsom_metrics:delete_metric(Name).
+ ok.
-spec gauge_exists/1 :: (ne_binary()) -> true | false.
gauge_exists(Name) ->
- folsom_metrics:metric_exists(Name).
+ %folsom_metrics:metric_exists(Name).
+ true.
@@ -128,21 +128,25 @@ get(Name, Resolution) ->
-spec init_timer/2 :: (ne_binary(), erlang:timestamp()) -> ok.
init_timer(Name, Value) ->
- folsom_metrics:new_gauge(Name),
+ %folsom_metrics:new_gauge(Name),
update_timer(Name, Value).
-spec update_timer/2 :: (ne_binary(), erlang:timestamp()) -> ok.
update_timer(Name, Value) ->
- folsom_metrics:notify({Name, Value}).
+ %folsom_metrics:notify({Name, Value}).
+ ok.
-spec get_timer/1 :: (ne_binary()) -> erlang:timestamp().
get_timer(Name) ->
- folsom_metrics:get_metric_value(Name).
+ %folsom_metrics:get_metric_value(Name).
+ erlang:now().
-spec delete_timer/1 :: (ne_binary()) -> ok.
delete_timer(Name) ->
- folsom_metrics:delete_metric(Name).
+ %folsom_metrics:delete_metric(Name).
+ ok.
-spec timer_exists/1 :: (ne_binary()) -> true | false.
timer_exists(Name) ->
- folsom_metrics:metric_exists(Name).
+ %folsom_metrics:metric_exists(Name).
+ true.
@@ -20,9 +20,9 @@
-define(CHILD(Name, Type), fun(N, cache) -> {N, {wh_cache, start_link, [N]}, permanent, 5000, worker, [wh_cache]};
(N, T) -> {N, {N, start_link, []}, permanent, 5000, T, [N]} end(Name, Type)).
%% -define(CHILDREN, [{skel_listener, worker}, {skel_cache, cache}]).
--define(CHILDREN, [{folsom_sup, supervisor}
- ,{whistle_stats_couchbeam, worker}
- ,{whistle_stats_statsd, worker}
+-define(CHILDREN, [%{folsom_sup, supervisor}
+ %,{whistle_stats_couchbeam, worker}
+ %,{whistle_stats_statsd, worker}
]).
%% ===================================================================

0 comments on commit 07df298

Please sign in to comment.