aws-solutions / distributed-load-testing-on-aws

Distributed Load Testing on AWS
https://aws.amazon.com/solutions/implementations/distributed-load-testing-on-aws/
Other
324 stars 118 forks source link

Proper method to get batch mode .jtl file #150

Open cshowersPersonal opened 6 months ago

cshowersPersonal commented 6 months ago

Currently I'm using listeners to get the log files I need for my runs which DLT nicely uploads to JMeter_Results. I've done this for a while to get around not having a means to get a jtl file that you'd get if you were to run in command line mode.

Is there a way to get the equivalent of command line jtl file to load into JMeter_Results? It appears the approach I'm using is incompatible with the merge results addon and was hoping I could ditch the listeners AND leverage mergeResults when I needed to if there were a way to do this. Searched the past issues and could not find this addressed anywhere.

kamyarz-aws commented 6 months ago

Right now there is no way that we could customize the output in any way. However you can customize our code to suit your need. in our github repo there is a load-test.sh, you can have a run with mergeResults, addon see what jtl files get generated and then customize load-test.sh to copy those content to a prefix in s3 bucket. Specifically check between the lines 88 to 105 of to see what and how things get copied to Jmeter_results folder.

LeslieMurphy commented 3 weeks ago

Can you update load-test.sh so it copies over the jtl file after the test completes? I think the file is called kpi.jtl so this should work

aws s3 cp /tmp/artifacts/kpi.jtl s3://$S3_BUCKET/results/${TEST_ID}/jmeter-${PREFIX}-${UUID}-${AWS_REGION}.jtl --region $MAIN_STACK_REGION

ALSO: Is there a way to customize the contents of the JTL? For example, when running load tests outside of DLT I use this option to add a custom variable into the JTL file:

-Jsample_variables=AWStraceid

Along with a JSR223 PostProcessor:

String respHdrs =  prev.getResponseHeaders()
if (respHdrs) {
    def matches = (respHdrs =~ /X-Amzn-Trace-Id: Root=(.*)/)
    if (matches.size() > 0) {
        def traceid = matches[0][1]
        log.info ("****  ${prev.getSampleLabel()} ${traceid} Time ${prev.getTime()} Latency ${prev.getLatency()}")
        vars.put('AWStraceid', "${traceid}" )
    }
    else {
        vars.put('AWStraceid', "NONE" )
        }
}