Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add current transaction name in match.log

  • Loading branch information...
commit a7bcc77e3e29e29cf85de2ce6cf60c55fb4e481c 1 parent d0f62f2
@nniclausse nniclausse authored
View
38 src/test/ts_test_match.erl
@@ -25,99 +25,99 @@ test()->
match_abort_ok_test() ->
myset_env(),
Data="C'est n'est pas une chaine de caractere",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=abort, 'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=abort, 'when'=match}],Data, ?COUNTS,[],[])).
match_abort_nok_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(0, ts_search:match([#match{regexp="Erreur", do=abort, 'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(0, ts_search:match([#match{regexp="Erreur", do=abort, 'when'=match}],Data, ?COUNTS,[],[])).
nomatch_abort_ok_test() ->
myset_env(),
Data="C'est n'est pas une chaine de caractere",
- ?assertMatch(0, ts_search:match([#match{regexp="Erreur", do=abort, 'when'=nomatch}],Data, ?COUNTS,[])).
+ ?assertMatch(0, ts_search:match([#match{regexp="Erreur", do=abort, 'when'=nomatch}],Data, ?COUNTS,[],[])).
nomatch_abort_nok_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=abort, 'when'=nomatch}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=abort, 'when'=nomatch}],Data, ?COUNTS,[],[])).
nomatch_continue_ok_test() ->
myset_env(),
Data="C'est n'est pas une chaine de caractere",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=continue, 'when'=nomatch}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=continue, 'when'=nomatch}],Data, ?COUNTS,[],[])).
nomatch_continue_nok_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=continue, 'when'=nomatch}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=continue, 'when'=nomatch}],Data, ?COUNTS,[],[])).
match_continue_ok_test() ->
myset_env(),
Data="C'est n'est pas une chaine de caractere",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=continue, 'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=continue, 'when'=match}],Data, ?COUNTS,[],[])).
match_continue_nok_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=continue, 'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=continue, 'when'=match}],Data, ?COUNTS,[],[])).
nomatch_loop_ok_test() ->
myset_env(),
Data="C'est n'est pas une chaine de caractere",
- ?assertMatch(?COUNT+1, ts_search:match([#match{regexp="Erreur", do=loop, max_loop=?COUNT, loop_back=0, sleep_loop=1,'when'=nomatch}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT+1, ts_search:match([#match{regexp="Erreur", do=loop, max_loop=?COUNT, loop_back=0, sleep_loop=1,'when'=nomatch}],Data, ?COUNTS,[],[])).
nomatch_loop_nok_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=loop, max_loop=?COUNT, loop_back=0, sleep_loop=1,'when'=nomatch}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=loop, max_loop=?COUNT, loop_back=0, sleep_loop=1,'when'=nomatch}],Data, ?COUNTS,[],[])).
match_loop_ok_test() ->
myset_env(),
Data="C'est n'est pas une chaine de caractere",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=loop, max_loop=?COUNT, loop_back=0, sleep_loop=1,'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=loop, max_loop=?COUNT, loop_back=0, sleep_loop=1,'when'=match}],Data, ?COUNTS,[],[])).
match_loop_nok_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?COUNT+1, ts_search:match([#match{regexp="Erreur", do=loop, max_loop=?COUNT, loop_back=0, sleep_loop=1, 'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT+1, ts_search:match([#match{regexp="Erreur", do=loop, max_loop=?COUNT, loop_back=0, sleep_loop=1, 'when'=match}],Data, ?COUNTS,[],[])).
nomatch_restart_ok_test() ->
myset_env(),
Data="C'est n'est pas une chaine de caractere",
- ?assertMatch(?MAX_COUNT, ts_search:match([#match{regexp="Erreur", do=restart, max_restart=?COUNT,'when'=nomatch}],Data, ?COUNTS,[])).
+ ?assertMatch(?MAX_COUNT, ts_search:match([#match{regexp="Erreur", do=restart, max_restart=?COUNT,'when'=nomatch}],Data, ?COUNTS,[],[])).
nomatch_restart_nok_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=restart, max_restart=?COUNT,'when'=nomatch}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=restart, max_restart=?COUNT,'when'=nomatch}],Data, ?COUNTS,[],[])).
match_restart_ok_test() ->
myset_env(),
Data="C'est n'est pas une chaine de caractere",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=restart, max_restart=?COUNT,'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="Erreur", do=restart, max_restart=?COUNT,'when'=match}],Data, ?COUNTS,[],[])).
match_restart_nok_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?MAX_COUNT, ts_search:match([#match{regexp="Erreur", do=restart, max_restart=?COUNT, 'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?MAX_COUNT, ts_search:match([#match{regexp="Erreur", do=restart, max_restart=?COUNT, 'when'=match}],Data, ?COUNTS,[],[])).
match_subst_undef_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="%%_mydynvar%%", do=restart, subst=true, 'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="%%_mydynvar%%", do=restart, subst=true, 'when'=match}],Data, ?COUNTS,[],[])).
match_subst_undef2_test() ->
myset_env(),
Data="Ceci est une Erreur",
- ?assertMatch(?COUNT, ts_search:match([#match{regexp="ttt%%_mydynvar%%", do=restart, subst=true, 'when'=match}],Data, ?COUNTS,[])).
+ ?assertMatch(?COUNT, ts_search:match([#match{regexp="ttt%%_mydynvar%%", do=restart, subst=true, 'when'=match}],Data, ?COUNTS,[],[])).
match_subst_test() ->
myset_env(),
Data="Ceci est une Erreur ",
Dynvar=ts_dynvars:new(mydynvar,"Erreur"),
- ?assertMatch(?MAX_COUNT, ts_search:match([#match{regexp="%%_mydynvar%%", do=restart, subst=true, 'when'=match}],Data, ?COUNTS,Dynvar)).
+ ?assertMatch(?MAX_COUNT, ts_search:match([#match{regexp="%%_mydynvar%%", do=restart, subst=true, 'when'=match}],Data, ?COUNTS,Dynvar,[])).
myset_env()->
myset_env(0).
View
8 src/tsung/ts_client.erl
@@ -1005,7 +1005,7 @@ handle_data_msg(Data, State=#state_rcv{request=Req}) when Req#ts_request.ack==no
ts_mon:rcvmes({State#state_rcv.dump, self(), Data}),
{State, []};
-handle_data_msg(Data,State=#state_rcv{dump=Dump,request=Req,id=Id,clienttype=Type,maxcount=MaxCount})
+handle_data_msg(Data,State=#state_rcv{dump=Dump,request=Req,id=Id,clienttype=Type,maxcount=MaxCount,transactions=Transactions})
when Req#ts_request.ack==parse->
ts_mon:rcvmes({Dump, self(), Data}),
@@ -1020,7 +1020,7 @@ handle_data_msg(Data,State=#state_rcv{dump=Dump,request=Req,id=Id,clienttype=Typ
MatchArgs={NewState#state_rcv.count, MaxCount,
NewState#state_rcv.session_id, Id},
NewDynVars=ts_dynvars:merge(DynVars,(NewState#state_rcv.dyndata)#dyndata.dynvars),
- NewCount =ts_search:match(Req#ts_request.match,NewBuffer,MatchArgs,NewDynVars),
+ NewCount =ts_search:match(Req#ts_request.match,NewBuffer,MatchArgs,NewDynVars,Transactions),
NewDynData=(NewState#state_rcv.dyndata)#dyndata{dynvars=NewDynVars},
Type:dump(Dump,{Req,NewState#state_rcv.session,Id,
NewState#state_rcv.host,NewState#state_rcv.datasize}),
@@ -1081,7 +1081,7 @@ handle_data_msg(Data,State=#state_rcv{request=Req,datasize=OldSize})
handle_data_msg(<<32>>, State=#state_rcv{clienttype=ts_jabber}) ->
{State#state_rcv{ack_done = false},[]};
%% local ack, set ack_done to true
-handle_data_msg(Data, State=#state_rcv{request=Req, maxcount=MaxCount}) ->
+handle_data_msg(Data, State=#state_rcv{request=Req, maxcount=MaxCount, transactions=Transactions}) ->
ts_mon:rcvmes({State#state_rcv.dump, self(), Data}),
NewBuffer= set_new_buffer(State, Data),
DataSize = size(Data),
@@ -1090,7 +1090,7 @@ handle_data_msg(Data, State=#state_rcv{request=Req, maxcount=MaxCount}) ->
MatchArgs={State#state_rcv.count,MaxCount,State#state_rcv.session_id,
State#state_rcv.id},
NewDynVars=ts_dynvars:merge(DynVars,(State#state_rcv.dyndata)#dyndata.dynvars),
- NewCount =ts_search:match(Req#ts_request.match, NewBuffer, MatchArgs,NewDynVars),
+ NewCount =ts_search:match(Req#ts_request.match, NewBuffer, MatchArgs, NewDynVars, Transactions),
NewDynData=(State#state_rcv.dyndata)#dyndata{dynvars=NewDynVars},
{State#state_rcv{ack_done = true, buffer= NewBuffer, dyndata = NewDynData,
page_timestamp= PageTimeStamp, count=NewCount},[]}.
View
10 src/tsung/ts_mon_cache.erl
@@ -76,9 +76,9 @@ add(Data) ->
gen_server:cast(?MODULE, {add, Data}).
%% @spec add_match(Data::list(),{UserId::integer(),SessionId::integer(),RequestId::integer(),
-%% TimeStamp::tuple()}) -> ok
-add_match(Data,{UserId,SessionId,RequestId,TimeStamp,Bin}) ->
- gen_server:cast(?MODULE, {add_match, Data, {UserId,SessionId,RequestId,TimeStamp,Bin}}).
+%% TimeStamp::tuple(), Transactions::list()}) -> ok
+add_match(Data,{UserId,SessionId,RequestId,TimeStamp,Bin,Tr}) ->
+ gen_server:cast(?MODULE, {add_match, Data, {UserId,SessionId,RequestId,TimeStamp,Bin,Tr}}).
%%====================================================================
%% Server functions
@@ -124,9 +124,9 @@ handle_cast({add, Data}, State) when is_list(Data) ->
{noreply, LastState };
handle_cast({add, Data}, State) when is_tuple(Data) ->
{noreply,update_stats(Data, State)};
-handle_cast({add_match, Data=[First|_Tail],{UserId,SessionId,RequestId,TimeStamp,Bin}},
+handle_cast({add_match, Data=[First|_Tail],{UserId,SessionId,RequestId,TimeStamp,Bin,Tr}},
State=#state{stats=List, match=MatchList})->
- NewMatchList=lists:append([{UserId,SessionId,RequestId,TimeStamp,First, Bin}], MatchList),
+ NewMatchList=lists:append([{UserId,SessionId,RequestId,TimeStamp,First, Bin, Tr}], MatchList),
{noreply, State#state{stats = lists:append(Data, List), match = NewMatchList}};
handle_cast(_Msg, State) ->
View
58 src/tsung/ts_search.erl
@@ -31,7 +31,7 @@
-module(ts_search).
-vc('$Id$ ').
--export([subst/2, match/4, parse_dynvar/2]).
+-export([subst/2, match/5, parse_dynvar/2]).
-include("ts_profile.hrl").
@@ -115,40 +115,40 @@ extract_function([H|Tail],DynVar, Acc, Mod, Fun) ->
extract_function(Tail, DynVar, Acc, Mod, [H|Fun]).
%%----------------------------------------------------------------------
-%% @spec match(Match::#match{}, Data::binary() | list, {Counts::integer(),
-%% Max::integer(), SessionId::integer(),UserId::integer()}, Dynvars::term()
-%% ) -> Count::integer()
+%% @spec match(Match::#match{}, Data::binary() | list,
+%% {Counts::integer(), Max::integer(), SessionId::integer(), UserId::integer()},
+%% Dynvars::term(), Transactions::list() ) -> Count::integer()
%% @doc search for regexp in Data; send result to ts_mon
%% @end
%%----------------------------------------------------------------------
-match([], _Data, {Count, _MaxC, _SessionId, _UserId}, _DynVars) -> Count;
-match([Match=#match{'skip_headers'=http}|Tail], Data, Counts,DynVars) when is_binary(Data)->
+match([], _Data, {Count, _MaxC, _SessionId, _UserId}, _DynVars, _Tr) -> Count;
+match([Match=#match{'skip_headers'=http}|Tail], Data, Counts, DynVars, Tr) when is_binary(Data)->
%% keep http body only
case re:run(Data,"\\r\\n\\r\\n(.*)",[{capture,all_but_first,binary},dotall]) of
{match,[NewData]} ->
- match([Match#match{'skip_headers'=no}|Tail], NewData, Counts, DynVars);
+ match([Match#match{'skip_headers'=no}|Tail], NewData, Counts, DynVars, Tr);
_ ->
?LOGF("Skip http headers failure, data was: ~p ~n",[Data], ?ERR),
- match([Match#match{'skip_headers'=no}|Tail], Data, Counts, DynVars)
+ match([Match#match{'skip_headers'=no}|Tail], Data, Counts, DynVars, Tr)
end;
-match([Match=#match{'apply_to_content'=undefined}|Tail], Data, Counts,DynVars) ->
+match([Match=#match{'apply_to_content'=undefined}|Tail], Data, Counts,DynVars,Tr) ->
?DebugF("Matching Data size ~p; apply undefined~n",[size(Data)]),
- match([Match|Tail], Data, Counts, [],DynVars);
-match([Match=#match{'apply_to_content'={Module,Fun}}|Tail], Data, Counts,DynVars) ->
+ match([Match|Tail], Data, Counts, [],DynVars, Tr);
+match([Match=#match{'apply_to_content'={Module,Fun}}|Tail], Data, Counts,DynVars,Tr) ->
?DebugF("Matching Data size ~p; apply ~p:~p~n",[size(Data),Module,Fun]),
NewData = Module:Fun(Data),
?DebugF("Match: apply result =~p~n",[NewData]),
- match([Match|Tail], NewData, Counts, [],DynVars).
+ match([Match|Tail], NewData, Counts, [],DynVars, Tr).
%% @spec match(Match::#match{}, Data::binary() | list(), Count::tuple(),
%% Stats::list(), DynVars::term()) -> Count::integer()
-match([], _Data, {Count,_, _,_}, Stats, _) ->
+match([], _Data, {Count,_, _,_}, Stats, _, _) ->
%% all matches done, add stats, and return Count unchanged (continue)
ts_mon:add(Stats),
Count;
match([Match=#match{regexp=RawRegExp,subst=Subst, do=Action, 'when'=When}
- |Tail], Data,Counts,Stats,DynVars)->
+ |Tail], Data,Counts,Stats,DynVars, Tr)->
RegExp = case Subst of
true -> subst(RawRegExp, DynVars);
_ -> RawRegExp
@@ -157,10 +157,10 @@ match([Match=#match{regexp=RawRegExp,subst=Subst, do=Action, 'when'=When}
case re:run(Data, RegExp) of
{When,_} ->
?LOGF("Ok Match (regexp=~p) do=~p~n",[RegExp,Action], ?INFO),
- setcount(Match, Counts, [{count, match}| Stats], Data);
+ setcount(Match, Counts, [{count, match}| Stats], Data, Tr);
When -> % nomatch
?LOGF("Bad Match (regexp=~p) do=~p~n",[RegExp, Action], ?INFO),
- setcount(Match, Counts, [{count, nomatch} | Stats],Data);
+ setcount(Match, Counts, [{count, nomatch} | Stats],Data,Tr);
{match,_} -> % match but when=nomatch
?LOGF("Ok Match (regexp=~p)~n",[RegExp], ?INFO),
case Action of
@@ -168,7 +168,7 @@ match([Match=#match{regexp=RawRegExp,subst=Subst, do=Action, 'when'=When}
restart -> put(restart_count, 0);
_ -> ok
end,
- match(Tail, Data, Counts, [{count, match} | Stats],DynVars);
+ match(Tail, Data, Counts, [{count, match} | Stats],DynVars, Tr);
nomatch -> % nomatch but when=match
?LOGF("Bad Match (regexp=~p)~n",[RegExp], ?INFO),
case Action of
@@ -176,10 +176,10 @@ match([Match=#match{regexp=RawRegExp,subst=Subst, do=Action, 'when'=When}
restart -> put(restart_count, 0);
_ -> ok
end,
- match(Tail, Data, Counts,[{count, nomatch} | Stats],DynVars);
+ match(Tail, Data, Counts,[{count, nomatch} | Stats],DynVars,Tr);
{error,_Error} ->
?LOGF("Error while matching: bad REGEXP (~p)~n", [RegExp], ?ERR),
- match(Tail, Data, Counts,[{count, badregexp} | Stats],DynVars)
+ match(Tail, Data, Counts,[{count, badregexp} | Stats],DynVars,Tr)
end.
%%----------------------------------------------------------------------
@@ -190,18 +190,18 @@ match([Match=#match{regexp=RawRegExp,subst=Subst, do=Action, 'when'=When}
%% - if restart is true, we must start again the whole session, set count to MaxCount
%% - if stop is true, set count to 0
%%----------------------------------------------------------------------
-setcount(#match{do=continue}, {Count, _MaxC, _SessionId, _UserId}, Stats,_)->
+setcount(#match{do=continue}, {Count, _MaxC, _SessionId, _UserId}, Stats,_,_)->
ts_mon:add(Stats),
Count;
-setcount(#match{do=log}, {Count, MaxC, SessionId, UserId}, Stats,_)->
- ts_mon:add_match(Stats,{UserId,SessionId,MaxC-Count}),
+setcount(#match{do=log}, {Count, MaxC, SessionId, UserId}, Stats,_,Tr)->
+ ts_mon:add_match(Stats,{UserId,SessionId,MaxC-Count,Tr}),
Count;
-setcount(#match{do=dump}, {Count, MaxC, SessionId, UserId}, Stats,Data)->
- ts_mon:add_match(Stats,{UserId,SessionId,MaxC-Count, Data}),
+setcount(#match{do=dump}, {Count, MaxC, SessionId, UserId}, Stats, Data, Tr)->
+ ts_mon:add_match(Stats,{UserId,SessionId,MaxC-Count, Data, Tr}),
Count;
-setcount(#match{do=restart, max_restart=MaxRestart}, {Count, MaxC,SessionId,UserId}, Stats,_)->
+setcount(#match{do=restart, max_restart=MaxRestart}, {Count, MaxC,SessionId,UserId}, Stats,_, Tr)->
CurRestart = get(restart_count),
- Ids={UserId,SessionId,MaxC-Count},
+ Ids={UserId,SessionId,MaxC-Count,Tr},
?LOGF("Restart on (no)match ~p~n",[CurRestart], ?INFO),
case CurRestart of
undefined ->
@@ -217,7 +217,7 @@ setcount(#match{do=restart, max_restart=MaxRestart}, {Count, MaxC,SessionId,User
ts_mon:add_match([{count, match_restart} | Stats],Ids),
MaxC
end;
-setcount(#match{do=loop,loop_back=Back,max_loop=MaxLoop,sleep_loop=Sleep},{Count,_MaxC,_SessionId,_UserId},Stats,_)->
+setcount(#match{do=loop,loop_back=Back,max_loop=MaxLoop,sleep_loop=Sleep},{Count,_MaxC,_SessionId,_UserId},Stats,_,_)->
CurLoop = get(loop_count),
?LOGF("Loop on (no)match ~p~n",[CurLoop], ?INFO),
ts_mon:add([{count, match_loop} | Stats]),
@@ -235,8 +235,8 @@ setcount(#match{do=loop,loop_back=Back,max_loop=MaxLoop,sleep_loop=Sleep},{Count
timer:sleep(Sleep),
Count + 1 + Back
end;
-setcount(#match{do=abort}, {Count,MaxC,SessionId,UserId}, Stats,_) ->
- ts_mon:add_match([{count, match_stop} | Stats],{UserId,SessionId,MaxC-Count}),
+setcount(#match{do=abort}, {Count,MaxC,SessionId,UserId}, Stats,_, Tr) ->
+ ts_mon:add_match([{count, match_stop} | Stats],{UserId,SessionId,MaxC-Count,Tr}),
0.
%%----------------------------------------------------------------------
View
18 src/tsung_controller/ts_match_logger.erl
@@ -97,7 +97,7 @@ init([LogDir]) ->
case file:open(Filename,[write, {delayed_write, ?DELAYED_WRITE_SIZE, ?DELAYED_WRITE_DELAY}]) of
{ok, Fd} ->
?LOG("starting match logger~n",?NOTICE),
- io:format(Fd,"# timestamp userid sessionid requestid event~n",[]),
+ io:format(Fd,"# timestamp userid sessionid requestid event transaction~n",[]),
{ok, #state{ fd = Fd,
filename = Filename,
logdir = LogDir
@@ -128,7 +128,7 @@ handle_call(Request, _From, State) ->
%% {stop, Reason, State} (terminate/2 is called)
%%----------------------------------------------------------------------
handle_cast({add, List}, State) when is_list(List)->
- NewState=lists:foldl(fun(X,Acc)-> log(X,Acc) end,State, List),
+ NewState=lists:foldr(fun(X,Acc)-> log(X,Acc) end,State, List),
{noreply,NewState};
handle_cast({add, Data}, State) when is_tuple(Data)->
@@ -173,13 +173,19 @@ code_change(_OldVsn, StateData, _Extra) ->
%%% Internal functions
%%%----------------------------------------------------------------------
-log({UserId,SessionId,RequestId,TimeStamp,{count, Val},[]},State=#state{fd=File}) ->
+log({UserId,SessionId,RequestId,TimeStamp,{count, Val},[], Tr},State=#state{fd=File}) ->
TS=ts_utils:time2sec_hires(TimeStamp),
- io:format(File,"~f ~B ~B ~B ~p~n",[TS,UserId,SessionId,RequestId,Val]),
+ io:format(File,"~f ~B ~B ~B ~p ~s~n",[TS,UserId,SessionId,RequestId,Val,log_transaction(Tr)]),
State;
-log({UserId,SessionId,RequestId,TimeStamp,{count, Val},Bin}, State=#state{logdir=LogDir, dumpid=Id}) ->
- log({UserId,SessionId,RequestId,TimeStamp,{count, Val},[]}, State),
+log({UserId,SessionId,RequestId,TimeStamp,{count, Val},Bin, Tr}, State=#state{logdir=LogDir, dumpid=Id}) ->
+ log({UserId,SessionId,RequestId,TimeStamp,{count, Val},[],Tr}, State),
Name=ts_utils:join("-",lists:map(fun integer_to_list/1,[UserId,SessionId,RequestId,Id])),
Filename=filename:join(LogDir, "match-"++ Name ++".dump"),
file:write_file(Filename,Bin),
State#state{dumpid=Id+1}.
+
+
+log_transaction([]) ->
+ "-";
+log_transaction([{TransactionName,_}| _Tail]) ->
+ TransactionName.
View
8 src/tsung_controller/ts_mon.erl
@@ -106,12 +106,12 @@ add(nocache,Data) ->
add(Data) ->
ts_mon_cache:add(Data).
-add_match(Data,{UserId,SessionId,RequestId}) ->
- add_match(Data,{UserId,SessionId,RequestId,[]});
-add_match(Data=[Head|_],{UserId,SessionId,RequestId,Bin}) ->
+add_match(Data,{UserId,SessionId,RequestId,Tr}) ->
+ add_match(Data,{UserId,SessionId,RequestId,[],Tr});
+add_match(Data=[Head|_],{UserId,SessionId,RequestId,Bin,Tr}) ->
TimeStamp=now(),
put(last_match,Head),
- ts_mon_cache:add_match(Data,{UserId,SessionId,RequestId,TimeStamp, Bin}).
+ ts_mon_cache:add_match(Data,{UserId,SessionId,RequestId,TimeStamp, Bin,Tr}).
status() ->
gen_server:call({global, ?MODULE}, {status}).
Please sign in to comment.
Something went wrong with that request. Please try again.