aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2014-05-21 01:07:00 +0200
committerAnders Svensson <[email protected]>2014-05-22 08:37:50 +0200
commit6642bfc89b9a9863ea1f4864d28b96b075beedd8 (patch)
tree5a91f55687908ec8252a44c46705ab73c7ea2ad4 /lib/diameter/src
parent90cd10632ff2bcc6c541ac544728f18097290301 (diff)
downloadotp-6642bfc89b9a9863ea1f4864d28b96b075beedd8.tar.gz
otp-6642bfc89b9a9863ea1f4864d28b96b075beedd8.tar.bz2
otp-6642bfc89b9a9863ea1f4864d28b96b075beedd8.zip
Count decode errors in incoming requests
Errors were only counted in incoming answers. Counters are keyed on tuples of the same form: {{ApplicationId, CommandCode, Rbit}, recv, error}
Diffstat (limited to 'lib/diameter/src')
-rw-r--r--lib/diameter/src/base/diameter_peer_fsm.erl2
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl21
-rw-r--r--lib/diameter/src/base/diameter_watchdog.erl3
3 files changed, 23 insertions, 3 deletions
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl
index ae890d67d7..4978c1e049 100644
--- a/lib/diameter/src/base/diameter_peer_fsm.erl
+++ b/lib/diameter/src/base/diameter_peer_fsm.erl
@@ -650,6 +650,8 @@ handle_request(Type, #diameter_packet{} = Pkt, #state{dictionary = D} = S) ->
%% send_answer/3
send_answer(Type, ReqPkt, #state{transport = TPid, dictionary = Dict} = S) ->
+ diameter_traffic:incr_R(recv, ReqPkt, TPid),
+
#diameter_packet{header = H,
transport_data = TD}
= ReqPkt,
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 908f5ff9bf..29d21fa7dc 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -32,7 +32,8 @@
-export([receive_message/4]).
%% towards diameter_peer_fsm and diameter_watchdog
--export([incr_A/4]).
+-export([incr_A/4,
+ incr_R/3]).
%% towards diameter_service
-export([make_recvdata/1,
@@ -138,6 +139,18 @@ incr_A(Dir, Pkt, TPid, Dict0) ->
end.
%% ---------------------------------------------------------------------------
+%% incr_R/3
+%% ---------------------------------------------------------------------------
+
+%% incr_R/3
+
+incr_R(recv = D, #diameter_packet{header = H, errors = [_|_]}, TPid) ->
+ incr_error(diameter_codec:msg_id(H), D, TPid);
+
+incr_R(_, _, _) ->
+ ok.
+
+%% ---------------------------------------------------------------------------
%% pending/1
%% ---------------------------------------------------------------------------
@@ -241,6 +254,7 @@ recv_R({#diameter_app{id = Id, dictionary = Dict} = App, Caps},
Dict0,
RecvData) ->
Pkt = errors(Id, diameter_codec:decode(Id, Dict, Pkt0)),
+ incr_R(recv, Pkt, TPid),
{Caps, Pkt, App, recv_R(App, TPid, Dict0, Caps, RecvData, Pkt)};
%% Note that the decode is different depending on whether or not Id is
%% ?APP_ID_RELAY.
@@ -1022,7 +1036,7 @@ incr_A(Dir, Pkt, Dict, TPid, Dict0) ->
Id = diameter_codec:msg_id(Hdr),
%% Count incoming decode errors.
- recv /= Dir orelse [] == Es orelse incr(TPid, {Id, Dir, error}),
+ recv /= Dir orelse [] == Es orelse incr_error(Id, Dir, TPid),
%% Exit on a missing result code.
T = rc_counter(Dict, Msg),
@@ -1106,6 +1120,9 @@ x(Reason, F, A) ->
x(T) ->
exit(T).
+incr_error(Id, Dir, TPid) ->
+ incr(TPid, {Id, Dir, error}).
+
%% ---------------------------------------------------------------------------
%% # send_request/4
%%
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index c17a3bde5d..710017e62f 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -559,6 +559,7 @@ recv(Name, Pkt, S) ->
rcv('DWR', Pkt, #watchdog{transport = TPid,
dictionary = Dict0}) ->
+ diameter_traffic:incr_R(recv, diameter_codec:decode(Pkt), TPid),
EPkt = encode(dwa, Dict0, Pkt),
diameter_traffic:incr_A(send, EPkt, TPid, Dict0),
send(TPid, {send, EPkt}),