diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2014-08-21 01:11:31 -0500 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2014-08-21 02:35:56 -0500 |
commit | bbf59a2174772c76e26daa5afeeb6f6c038088fb (patch) | |
tree | 430f2c8065aefa6727fbda1616d589cbb25ca377 | |
parent | a853c32c5a3e5e353d169af7f4cf831f78d9ee1a (diff) | |
download | couchdb-bbf59a2174772c76e26daa5afeeb6f6c038088fb.tar.gz |
Update to use couch_stats
-rw-r--r-- | priv/stats_descriptions.cfg | 24 | ||||
-rw-r--r-- | src/rexi.app.src | 1 | ||||
-rw-r--r-- | src/rexi.erl | 6 | ||||
-rw-r--r-- | src/rexi_buffer.erl | 2 | ||||
-rw-r--r-- | src/rexi_monitor.erl | 1 |
5 files changed, 34 insertions, 0 deletions
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg new file mode 100644 index 000000000..93c29d95a --- /dev/null +++ b/priv/stats_descriptions.cfg @@ -0,0 +1,24 @@ +{[rexi, buffered], [ + {type, counter}, + {desc, <<"number of rexi messages buffered">>} +]}. +{[rexi, down], [ + {type, counter}, + {desc, <<"number of rexi_DOWN messages handled">>} +]}. +{[rexi, dropped], [ + {type, counter}, + {desc, <<"number of rexi messages dropped from buffers">>} +]}. +{[rexi, streams, timeout, init_stream], [ + {type, counter}, + {desc, <<"number of rexi stream initialization timeouts">>} +]}. +{[rexi, streams, timeout, stream], [ + {type, counter}, + {desc, <<"number of rexi stream timeouts">>} +]}. +{[rexi, streams, timeout, wait_for_ack], [ + {type, counter}, + {desc, <<"number of rexi stream timeouts while waiting for acks">>} +]}. diff --git a/src/rexi.app.src b/src/rexi.app.src index 639e9dcf0..efe128ca0 100644 --- a/src/rexi.app.src +++ b/src/rexi.app.src @@ -31,6 +31,7 @@ kernel, stdlib, couch_log, + couch_stats, config ]}, {mod, {rexi_app,[]}} diff --git a/src/rexi.erl b/src/rexi.erl index 69fbd7709..fea4d6453 100644 --- a/src/rexi.erl +++ b/src/rexi.erl @@ -134,6 +134,9 @@ stream_init(Timeout) -> rexi_STREAM_CANCEL -> exit(normal); timeout -> + couch_stats:increment_counter( + [rexi, streams, timeout, init_stream] + ), exit(timeout); Else -> exit({invalid_stream_message, Else}) @@ -179,6 +182,7 @@ stream(Msg, Limit, Timeout) -> erlang:send(Caller, {Ref, self(), Msg}), ok catch throw:timeout -> + couch_stats:increment_counter([rexi, streams, timeout, stream]), exit(timeout) end. @@ -205,6 +209,7 @@ stream2(Msg, Limit, Timeout) -> erlang:send(Caller, {Ref, self(), Msg}), ok catch throw:timeout -> + couch_stats:increment_counter([rexi, streams, timeout, stream]), exit(timeout) end. @@ -267,6 +272,7 @@ wait_for_ack(Count, Timeout) -> receive {rexi_ack, N} -> drain_acks(Count-N) after Timeout -> + couch_stats:increment_counter([rexi, streams, timeout, wait_for_ack]), throw(timeout) end. diff --git a/src/rexi_buffer.erl b/src/rexi_buffer.erl index 2be232256..d16dc8ba3 100644 --- a/src/rexi_buffer.erl +++ b/src/rexi_buffer.erl @@ -50,9 +50,11 @@ handle_call(get_buffered_count, _From, State) -> {reply, State#state.count, State, 0}. handle_cast({deliver, Dest, Msg}, #state{buffer = Q, count = C} = State) -> + couch_stats:increment_counter([rexi, buffered]), Q2 = queue:in({Dest, Msg}, Q), case should_drop(State) of true -> + couch_stats:increment_counter([rexi, dropped]), {noreply, State#state{buffer = queue:drop(Q2)}, 0}; false -> {noreply, State#state{buffer = Q2, count = C+1}, 0} diff --git a/src/rexi_monitor.erl b/src/rexi_monitor.erl index 7be3f0a5f..f143ead45 100644 --- a/src/rexi_monitor.erl +++ b/src/rexi_monitor.erl @@ -40,6 +40,7 @@ stop(MonitoringPid) -> %% internal functions %% notify_parent(Parent, Pid, Reason) -> + couch_stats:increment_counter([rexi, down]), erlang:send(Parent, {rexi_DOWN, self(), Pid, Reason}). should_monitor(Pid, Nodes) when is_pid(Pid) -> |