The Java Agent supports Jersey 1.x and 2.x by default.
Business transaction entry points are named using the following app agent node properties:
By default, the Java Agent makes a best-effort basis to name JAX-RS-based transactions using the class annotation, method annotation, and HTTP method of the detected entry point, in the following form:
In some situations where the annotation values are not available, the agent may name the transaction as follows:
For example, when the JAX RS service endpoints don't have the class and method names in them explicitly, but the annotations are inferred in some other way.
For annotation inheritance cases, the agent attempts to fetch the annotations from the superclasses and interfaces as described by the JAX RS specification. The specification makes the following recommendation:
For consistency with other Java EE specifications, it is recommended to always repeat annotations instead of relying on annotation inheritance.
Repeating annotations on the endpoint methods enables the Java Agent to name business transaction according to the default scheme.
The rest-transaction-naming
node agent property enables you to control naming for JAX-RS-based business transactions. You can use variables to have the transactions named with runtime values, for example, based on the method name, class name, parameter values, and more. For a full list of variables, see App Agent Node Properties Reference.
You can add a getter chain after any of the parameters to operate on the parameter values. To do so, add ':' followed by the getter chain. Standard getter chain escape requirements and rules apply.
The following example shows naming based on a part of the value of the sixth parameter:
The characters '{' and '}' are reserved. If used in getter chains or as text in the name the characters must be escaped with '\'. E.g. {{class-name
}} would display as {com.singularity.RestObject
}.
You can use characters in addition to parameters. For example, in the following example, the class name and method name are separated by a slash:
Based on this example, when the Java Agent sees a REST resource with a class name of com.company.rest.resources.Employees
with a CreateNewEmployee
method, it names the business transaction com.company.rest.resources.Employees/CreateNewEmployee
.