Couple months ago Dynatrace had released brand-new backend listener for JMeter which streams the performance stats from JMeter to Dynatrace. This backend listener sends the JMeter metrics to the Dynatrace environment via MINT. This blog post features about the Dynatrace Backend Listener for JMeter, how to integrate it, create dashboards and more.
Before we get started with the integration of Dynatrace backend listener in JMeter, let us fulfill the prerequisites.
- Dynatrace account. It is free to sign up.
- Sample demo app which is already integrated with Dynatrace
- Apache JMeter (the latest version)
- Sample JMeter test plan to execute a simple load test against the demo app.
Step 1 - Download JAR for JMeter
Download the JMeter plugin from the Dynatrace OSS repo. Download the latest version from the Assets as shown below.
If you want to build it on your own, clone the repo
cd into the folder and run
.\gradlew build in Powershell.
This will create build the jar for JMeter. Navigate to
jmeter-dynatrace-plugin-1.3-SNAPSHOT.jar to JMeter's
Launch JMeter and open the test plan which you are going to execute. Right click on the Thread Group > Add > Listener > Backend Listener.
Select the implementation as
com.dynatrace.jmeter.plugins.MintBackendListener as shown below.
Below are the default properties of Mint Backend Listener.
Step 2 - Configuring JMeter Backend Listener
To stream the JMeter performance stats to Dynatrace, the listener leverages Metric Ingest URL, API Token, test and transaction dimensions.
The URL would be your Dynatrace URL e.g.
The Environment ID can be copied from the browser URL once you logged into your Dynatrace.
To generate a token, login into Dynatrace account, navigate to Settings > Integration > Dynatrace API. Under My Dynatrace API Tokens click on Generate token as shown below.
Enter a name for your token, select
Ingest metrics under API v2 and then click on Generate button.
Click on Copy button and store the token in a secured place, because you cannot see it again in near future.
Dimensions can be specified using key=value pairs. There are two dimensions: test and transactions for test and test steps (samplers) related metrics respectively.
Following are the MINT metrics will be published during the test execution.
Below are the testDimensions will be generated when the test is running.
jmeter.usermetrics.startedthreads: the number of started threads
jmeter.usermetrics.finishedthreads: the number of finished threads
jmeter.usermetrics.minactivethreads: the minimum number of active threads
jmeter.usermetrics.maxactivethreads: the maximum number of active threads
jmeter.usermetrics.meanactivethreads: the arithmetic mean of active threads
c.d.j.p.MintMetricSender: addMetric(jmeter.usermetrics.minactivethreads,testname=Dynatrace-JMeter.jmx gauge,1.0 1609460965970) c.d.j.p.MintMetricSender: addMetric(jmeter.usermetrics.maxactivethreads,testname=Dynatrace-JMeter.jmx gauge,1.0 1609460965971) c.d.j.p.MintMetricSender: addMetric(jmeter.usermetrics.meanactivethreads,testname=Dynatrace-JMeter.jmx gauge,1.0 1609460965971) c.d.j.p.MintMetricSender: addMetric(jmeter.usermetrics.startedthreads,testname=Dynatrace-JMeter.jmx gauge,1.0 1609460965971) c.d.j.p.MintMetricSender: addMetric(jmeter.usermetrics.finishedthreads,testname=Dynatrace-JMeter.jmx gauge,1.0 1609460965971)
Below are the transactionDimensions.
jmeter.usermetrics.transaction.mintime: the minimal elapsed time for requests within sliding window
jmeter.usermetrics.transaction.maxtime: the maximal elapsed time for requests within sliding window
jmeter.usermetrics.transaction.meantime: the arithmetic mean of the elapsed time
jmeter.usermetrics.transaction.receivedbytes: the number of received bytes
jmeter.usermetrics.transaction.sentbytes: the number of sent bytes
jmeter.usermetrics.transaction.hits: the number of hits to the server
jmeter.usermetrics.transaction.error: the number of failed requests
jmeter.usermetrics.transaction.success: the number of successful requests
jmeter.usermetrics.transaction.count: the total number of requests
addMetric(jmeter.usermetrics.transaction.count,transaction=T00_HomePage,dt.entity.service=SERVICE-XXXXXXXXXXXXXXX gauge,1.0 1609460965969) addMetric(jmeter.usermetrics.transaction.success,transaction=T00_HomePage,dt.entity.service=SERVICE-XXXXXXXXXXXXXXX gauge,1.0 1609460965969) addMetric(jmeter.usermetrics.transaction.error,transaction=T00_HomePage,dt.entity.service=SERVICE-XXXXXXXXXXXXXXX gauge,0.0 1609460965969) addMetric(jmeter.usermetrics.transaction.hits,transaction=T00_HomePage,dt.entity.service=SERVICE-XXXXXXXXXXXXXXXX gauge,1.0 1609460965969) addMetric(jmeter.usermetrics.transaction.mintime,transaction=T00_HomePage,dt.entity.service=SERVICE-XXXXXXXXXXXXXXX gauge,26.0 1609460965969)
Dimensions are optional. But the metric and payload is required.
After adding all the values in the backend listener, this is how it looks. Instead of hard coding, all the values will be read from the test plan variables.
How to get the Service ID?
In Dynatrace, navigate to Application and services, click on the service name. In the browser URL, you can fetch the Service ID.
Copy the service id including the string
SERVICE- and 17 length string to JMeter.
Step 3 - Test Execution
Start your test in CLI mode. While the test is running, go to Dynatrace, click on Applications or Transactions and services make sure you are seeing the load test traffic in Dynatrace.
I am running a demo app in Flask at port 7000. If the integration between the demo app and Dynatrace is valid, you will see the traffic as shown below.
To view the JMeter metrics, go to Dashboard > Create Dashboard, enter a valid name and then click on Create.
Drag-and-drop the Custom Chart to the dashboard and then click on Configure custom chart.
Click on Try it out.
jmeter as shown below. Dynatrace will list out all the metrics available.
jmeter.usermetrics.maxactivethreads to get the maximum active threads and then click on Add Metric if you would like to add more metrics, else click on Run query.
You can customize the graph and colors under the Settings.
Here is how it looks for Single Value visualization.
To pin the above chart, click on Pin to dashboard and enter the title and then click on Pin, then click on Open Dashboard.
Here is the dashboard view.
Here is my sample dashboard which I customized. Beautiful, isn't it?
JMeter backend listener for Dynatrace streams the performance stats straight to Dynatrace. It will be helpful to compare the head-to-head metrics between Dynatrace and JMeter. Often, I present both the metrics to the architects, but with this integration, I save time and effort by migrating JMeter metrics to my dashboard.