Joe Hoffman (email@example.com)
JMeter Script Modification JMeter Script Converter
JMeter 2.x; dynaTrace v2.x v3.x
As you see in our documentation on web load testing, it is necessary to add a special HTTP header to web requests so they are correctly identified as synthetic requests and labelled appropriately by dynaTrace. In JMeter, this means that you'd have to add a HTTP Header Manager to every request sampler. In order to save you from this manual and potentially error-prone task, we provide two ways of automatically adding these headers to your JMeter scripts.
A BeanShell PreProcessor allows arbitrary code to be applied before a sampler is executed. This allows us to add the dynaTrace headers automatically, based on available context information such as the sampler name, thread group name, and thread group number.
By adding the BeanShell PreProcessor to a thread group, dynaTrace headers are added to all requests executed by controllers in this group. This approach requires only slight changes compared to test scripts processed by the script converter, and also supports request samplers added later to the script without requiring additional effort.
JMeter Tagging BeanShell PreProcessor
The JMeter Script converts existing JMeter script to dynaTrace header aware scripts by automatically adding these headers. For installation follow the instructions below.
Automatic Script Conversion
The script convert will create transaction names based on URLs. The timer name is created by extracting the "document" part of the URL. For http://localhost:9090/frontend/menu.do the timer menu will be created. Use the following command to convert a JMeter script.
Using Mapping Files
In case you want to use customer timer names or if you want to reuse timers, it is recommended to create a mapping file using the following command.
The mapping file is used to translate URLs to timer names. Below is an example mapping file of the GoSpace demo application. The format for mappings is <URL>:<Timer Name>. The use of mapping files is also very useful if you want to convert muliple scripts and automate the conversion task.
In order to use the mapping file for the conversion use the command below.
Please post a comment in case of bug reports, enhancements or questions.
This sample describes how to setup transactions within JMeter so that the Transaction name shows up within the dynaTrace Diagnostics Client under the Tagged Web Requests view.
When load scripts are executed from a load generator tool such as JMeter or Silk Performer, it is very helpful to define from within the Load generator tool specific transactions by name and be able to correlate those transaction names to what is being seen from within the dynaTrace Diagnostics Client GUI. This integration is automatic for the Silk Performer tool and can easily be done for load script tools such as JMeter. This Technology Sample describes how to do this for JMeter and provides a sample JMeter load script to be used against the dynaTrace sample application GoSpace.
The attached zip file contains a descriptive document on how to perform this integration as well as a JMeter script for exercising the GoSpace application which demonstrates the Tagged Web Request technology. The JMeter script assumes you already have JMeter downloaded and installed. From within JMeter, select File -> Open, and select the attached script file.
If you only want to track a single sampler rather tagging them all you can also add a custom HTTP Header Manager in jmeter which dynatrace has no trouble finding.
In Jmeter, Right click any HTTT Sampler -> Add -> Config Element -> HTTP Header Manager
Make an entry: Name: dynaTrace Value: PC=JMeter;NA=NameOfSampler
It looks like this script tags them all for you, which is good, less work is better.
you can define which requests get tagged based on what you specify in the mapping file. This is especially usefull if you have more than one script or you want to re-record it. However the header approach works fine because this is what the script actually does.
If you download the JMeter Script Modification attachment, it contains a PDF file which describes how to perform this type of manual change. This is very helpful to give to the JMeter script team so they understand the necessary script changes.
Of course this assumes you have chosen to not use the BeanShell PreProcessor.
Just took a potential customer and me some time to figure out how JMeter will produce a report based your loadtest which is running in separate thread groups. Since JMeter hasn't got an obvious concept of global variables (on a test plan scope) we found a way to save the session name you get when starting to record a session to use it later on in creating a report from that stored session.
The trick is to use the "BeanShell PostProcessor" to store the session name and retrieve it in a separate threadgroup at the end of the script.
More details in the example script attached to this post. JMeter Integrationthreadgroups and reporting.jmx
Credits go to Andreas Schmidt (A.Schmidt@vodafone.com) from Vodafone.
How we can integrate the web services scripts in Jmeter with Dynatrace?I have created two web service scripts in Jmter using sampler 'SOAP/XML RPC Request'.How Can I integrate this with Dynatrace.
Thanks In Advance
The best in this case is that you modify your JMeter script and add the requested HTTP Header with the name x-dynatrace to each of your simulated requests. More information about this HTTP Header and the general integration with load testing tools can be found here: Integration with Web Load Testing and Monitoring Tools
Later versions of JMeter seem a bit more restrictive when using the beanshell preprocessor to interpret the sampler. I've been comparing 2.9 to 2.4.
You need to make sure there is an HTTP Header Manager element above the preprocessor.
If you are using logic like "sampler instanceof HTTPSampler" to only tag HTTP samplers, they do not return as instances of HTTPSampler like in earlier versions. HTTPSamplerBase works in 2.9:
I was using the attached jmx in jmeter 2.4 and found that it added the dynatrace header multiple times if I had multiple requests in a thread group. I added
to its script to remove the previous header before adding the new one for the new sampler name. This resulted in a more meaningful view in Tagged Web Requests for me.
Thanks for sharing!!
Are these the same steps needed, when executing JMeter scripts from Jenkins. I have a customer that wants to see the Test Automation dashboards in Jenkins.
Yeah. doesnt matter how JMeter gets executed. These steps simply add the dynatrace header to the individual JMEter steps
Would the data also show up in the Jenkins dashboards or just in the test automation dashboards in dynatrace?
That depends on how you execute JMeter from Jenkins. There are plugins where you can feed the JMeter data back to Jenkins. Additional you would also get the dynatrace data through our plugin
I guess that depends on what exactly you mean by "Jenkins dashboards", but one thing I want to clarify: The web requests will only show up in the test automation dashboard if you run them as "Web API" tests, which means you have to register a test run first and then put that tag on the individual requests. If you don't do that they will "just" be tagged web requests, but not on the TA dashboard.
I wanted to ask a question, if there is any possibility that JMeter plugin can operate with Dynatrace 6.3 version.
Thanks for your time.
Hi. The Integration works with any version of dynatrace as the integration simply puts an additional HTTP Header on each requests. This additional HTTP Header tells Dynatrace about the Transaction Name and Step Name which will make it easier to then analyze the data in dynatrace as these names show up in the Dynatrace Tagged Web Request DAshlet as well as in the Load Testing Dashboard
I suggest you check out my YouTube Tutorial on Load Testing With Dynatrace where I explain how that integration works and how to best analyze the results