Header background

Request attributes: Numerical values, aggregations, & deep object access

Dynatrace recently introduced the ability to capture Java method arguments and use them as request attributes. This valuable new service-monitoring feature enables fine-grain service filtering and performance analysis. By defining request attributes for your service’s requests, you can enable advanced filtering of service requests across all Dynatrace analysis views. Once configured, request attributes help you to better understand the relationships between performance, errors, and application-specific metadata in your requests.

In many cases, you end up in a situation where you want to capture an argument of a method and the method is called multiple times. Sometimes you’re only interested in a specific value. In other cases, you may only want to count the executions or average the captured values. Within other values, the argument in question may be a complex object and you’re really only interested in one aspect of the object. Each of these use cases can now be addressed in the latest Dynatrace release.

Now when you analyze a request attribute in Dynatrace, you’ll notice that we’ve added a Data type drop list and an Aggregation on request drop list.

Choose and aggregate

It’s important to note that the aggregation tracks not only within a single data source (for example, a method rule) but also across multiple data sources. The order is defined by:

  1. Order of the data source rules
  2. Order of method rules within a method data source
  3. Order of method executions in your application, in case a method is executed multiple times.

For text attributes, you can choose between the following options.

  • First occurrence
  • Last occurrence
  • Set of distinct values

The Set of distinct values option enables you to use all distinct values found in a request for filtering. For example, say a request captures a request attribute called Product and two values are captured for this attribute, Book and Video. You can filter by either of these values to find the request in question.

For Integer or FloatingPoint values, you can additionally use the following aggregations:

This makes a lot of sense when a value in question is numerical, for example, a metric or revenue.

The last two possibilities are

  • Count occurrences
  • Count distinct

If you choose one of these possibilities, the data type changes to Integer automatically. These settings make a lot of sense when you’re counting something.

Filtering numeric values

When you have an attribute that represents a number, you need to consider multiple filtering options. Attributes that have the data type Integer or Double can be filtered in multiple ways (see below). 

The two fields are both optional, if neither is specified Dynatrace will simply check for the existence of the attribute. If you specify both the filter results in the display of only those requests that have the specific attribute with the defined value range.

Deep object access

A value that you’re interested in may not be available as a simple argument, but rather as part of a complex argument object or even a member variable of the class you’re looking at. Such values can now easily be accessed. As shown in the example below, note that you can now access not only argument values and return values, but also the object itself. Whenever an item to be captured (be it an argument or an object) is a complex object, you have the ability to define a method (chain) that enables deep access into the object. The example below uses the method getBookingCode. You can even execute a chain, for example, getBookingCode().getCustomerCode().

Note: The Deep object access feature introduces new code into your application that must be executed. As such, it may change the state of your application or introduce performance impact. So, proceed with caution in using this feature.