Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a combined total+meter (tmeter)

  • Loading branch information...
commit a6fc657da6440cd90546691649779a986fe74ff4 1 parent e95a295
@russelldb authored
View
7 ebin/riak_core.app
@@ -38,12 +38,13 @@
riak_core_handoff_sender_sup,
riak_core_handoff_sup,
riak_core_metric,
- riak_core_metric_sup,
- riak_core_metric_proc,
riak_core_metric_counter,
+ riak_core_metric_duration,
riak_core_metric_histogram,
riak_core_metric_meter,
- riak_core_metric_duration,
+ riak_core_metric_proc,
+ riak_core_metric_sup,
+ riak_core_metric_tmeter,
riak_core_nodeid,
riak_core_node_watcher,
riak_core_node_watcher_events,
View
43 src/riak_core_metric_tmeter.erl
@@ -0,0 +1,43 @@
+%%
+%% Copyright (c) 2007-2012 Basho Technologies, Inc. All Rights Reserved.
+%%
+%% This file is provided to you under the Apache License,
+%% Version 2.0 (the "License"); you may not use this file
+%% except in compliance with the License. You may obtain
+%% a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing,
+%% software distributed under the License is distributed on an
+%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+%% KIND, either express or implied. See the License for the
+%% specific language governing permissions and limitations
+%% under the License.
+%%
+%% -------------------------------------------------------------------
+
+%% @doc A meter and a total counter
+-module(riak_core_metric_tmeter).
+
+-behaviour(riak_core_metric).
+
+%% Behaviour API
+-export([new/0, value/2, value/3, update/2, tick/1]).
+
+new() ->
+ {0, riak_core_metric_meter:new()}.
+
+update({Cnt, Moment}, {Counter, Meter}) ->
+ {Counter+Cnt, riak_core_metric_meter:update({Cnt, Moment}, Meter)}.
+
+value(Name, Value) ->
+ CounterName = riak_core_metric:join_as_atom([Name, '_', total]),
+ value({CounterName, Name}, Name, Value).
+
+value({CounterName, MeterName}, _Name, {Counter, Meter}) ->
+ [{CounterName, Counter},
+ riak_core_metric_meter:value(MeterName, Meter)].
+
+tick({_Counter, Meter}) ->
+ riak_core_metric_meter:tick(Meter).
View
6 src/riak_core_stat.erl
@@ -33,11 +33,10 @@
-spec stat_specs() -> riak_core_metric:stat_specs().
stat_specs() ->
[{ignored_gossip_total, [{type, counter}, {group, gossip}]},
- {rings_reconciled_total, [{type, counter}, {group, gossip}]},
{rejected_handoffs, [{type, counter}, {group, gossip}]},
{handoff_timeouts, [{type, counter}, {group, gossip}]},
{gossip_received, [{type, meter}, {group, gossip}]},
- {rings_reconciled, [{type, meter}, {group, gossip}]},
+ {rings_reconciled, [{type, tmeter}, {group, gossip}]},
{converge_delay, [{type, duration}, {group, gossip},
{presentation,
[{legacy, [min, max, mean, last]}]}]},
@@ -73,8 +72,7 @@ update(ignored_gossip) ->
update(gossip_received) ->
riak_core_metric_proc:update(gossip_received, {1, slide:moment()});
update(rings_reconciled) ->
- riak_core_metric_proc:update(rings_reconciled, {1, slide:moment()}),
- riak_core_metric_proc:update(rings_reconciled_total, 1);
+ riak_core_metric_proc:update(rings_reconciled, {1, slide:moment()});
update(_) ->
ok.
Please sign in to comment.
Something went wrong with that request. Please try again.