How do I integrate Dynatrace into JMeter scripts?

While executing a load test in Apache JMeter, each simulated HTTP request can be tagged in JMeter with additional HTTP Headers that contain test-transaction information (for example, script name, test step name and virtual user ID). Dynatrace can analyze incoming HTTP headers and extract such contextual information from the header values and "tag" the captured requests. Having a tag on a request allows you to analyze requests with specific tags. For example, you can analyze all requests that come in from script Scenario1 and test step Put Item into Cart.

To integrate Dynatrace with JMeter:

  1. Within JMeter, use the HTTP Header Manager to add custom HTTP request headers. You can use any custom HTTP headers to pass context information. In this example, we use the header x-dynatrace-test and the set of key/value LSN=Scenario1;TSN=Put Item into Cart; for the header value. See How do I integrate Dynatrace into my load testing process? for more details on the recommended key/value pairs.

  1. In Dynatrace, configure the extraction rules for the custom HTTP Headers via Settings > Server-side service monitoring > Request attributes.

  2. Select HTTP request header as the Request attribute source and enter the name of your custom HTTP header in the Parameter name field. Extraction of data from a concatenated string (like LSN=Scenario1;TSN=Put Item into Cart;) can also be configured as shown below.

  1. Run your load test from JMeter. The requests and PurePaths will be tagged in Dynatrace with the configured request attributes for targeted diagnostics and analysis.

Further reading