Skip to content

Instantly share code, notes, and snippets.

@tisba
Last active December 25, 2015 18:49
Show Gist options
  • Select an option

  • Save tisba/7023440 to your computer and use it in GitHub Desktop.

Select an option

Save tisba/7023440 to your computer and use it in GitHub Desktop.
diff --git i/include/ts_config.hrl w/include/ts_config.hrl
index ceab838..28cbbb2 100644
--- i/include/ts_config.hrl
+++ w/include/ts_config.hrl
@@ -76,7 +76,8 @@
total_popularity = 0, % should be 100 if we use probabilites; sum of all weights if we use weights
use_weights , % true if we use weights instead of probabilities
total_server_weights=0,
- job_notify_port
+ job_notify_port,
+ tag
}).
diff --git i/include/ts_http.hrl w/include/ts_http.hrl
index 2150f50..1468f77 100644
--- i/include/ts_http.hrl
+++ w/include/ts_http.hrl
@@ -52,7 +52,8 @@
digest_nc,
digest_qop,
realm,
- soap_action % for SOAP support
+ soap_action, % for SOAP support
+ tag
}).
-record(url,
diff --git i/src/tsung/ts_http.erl w/src/tsung/ts_http.erl
index 31a6769..a45321a 100644
--- i/src/tsung/ts_http.erl
+++ w/src/tsung/ts_http.erl
@@ -104,7 +104,8 @@ dump(protocol,{#ts_request{param=HttpReq},HttpResp,UserId,Server,Size,Duration,T
Data=ts_utils:join(";",[integer_to_list(UserId),
atom_to_list(HttpReq#http_request.method), Server,
get(last_url), Status,integer_to_list(Size),
- Duration,Tr,Match,Error]
+ Duration,Tr,Match,Error,
+ HttpReq#http_request.tag]
),
ts_mon:dump({protocol, self(), Data });
dump(_,_) ->
diff --git i/src/tsung_controller/ts_config.erl w/src/tsung_controller/ts_config.erl
index 3dcf19f..2578568 100644
--- i/src/tsung_controller/ts_config.erl
+++ w/src/tsung_controller/ts_config.erl
@@ -673,7 +673,8 @@ parse(Element = #xmlElement{name=request, attributes=Attrs},
lists:foldl( fun(A,B) ->Type:parse_config(A,B) end,
Conf#config{curid=Id+1, cur_req_id=Id+1,
subst=SubstitutionFlag,
- match=[]
+ match=[],
+ tag=Tag
},
Element#xmlElement.content)
end;
diff --git i/src/tsung_controller/ts_config_http.erl w/src/tsung_controller/ts_config_http.erl
index 2b37752..457d7b1 100644
--- i/src/tsung_controller/ts_config_http.erl
+++ w/src/tsung_controller/ts_config_http.erl
@@ -78,7 +78,8 @@ parse_config(Element = #xmlElement{name=http},
version = Version,
get_ims_date= Date,
content_type= ContentType,
- body = Contents},
+ body = Contents,
+ tag = Config#config.tag},
%% SOAP Support: Add SOAPAction header to the message
Request2 = case lists:keysearch(soap,#xmlElement.name,
Element#xmlElement.content) of
diff --git i/src/tsung_controller/ts_mon.erl w/src/tsung_controller/ts_mon.erl
index c0bf8bb..9286e95 100644
--- i/src/tsung_controller/ts_mon.erl
+++ w/src/tsung_controller/ts_mon.erl
@@ -437,7 +437,7 @@ start_dump(State=#state{type=Type}) ->
?LOG("dump file opened, starting monitor~n",?INFO),
case Type of
protocol ->
- io:format(Stream,"#date;pid;id;http method;host;URL;HTTP status;size;duration;transaction;match;error~n",[]);
+ io:format(Stream,"#date;pid;id;http method;host;URL;HTTP status;size;duration;transaction;match;error;tag~n",[]);
_ ->
ok
end,
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/Users/basti/Documents/src/tsung/tsung-1.0.dtd">
<tsung loglevel="warning" version="1.0" dumptraffic="protocol">
<!-- Client side setup -->
<clients>
<client host="localhost" use_controller_vm="true"/>
</clients>
<servers>
<server host="localhost" port="3000" type="tcp"></server>
</servers>
<load>
<arrivalphase phase="1" duration="10" unit="minute">
<users interarrival="2" unit="second"></users>
</arrivalphase>
</load>
<sessions>
<session name="http-example" probability="100" type="ts_http">
<request tag="root"> <http url="/" method="GET" version="1.1"></http> </request>
<request tag="meh"> <http url="/meh" method="GET" version="1.1"></http> </request>
</session>
</sessions>
</tsung>
@rodo

rodo commented Oct 17, 2013

Copy link
Copy Markdown
  • use 'tag' instead of 'tags' that is the real name of the tag attribute
  • When you join, put the tags at last position to preserve existing scripts

@tisba

tisba commented Oct 17, 2013

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment