Help APM APM for Java Custom Instrumentation Using Java Annotations

Custom Instrumentation Using Java Annotations

Using Java annotations, APM Insight provides an easier way to custom instrument your application classes and methods. Usage of Java annotation enables you to define custom names for the transaction and also assign a custom component.

This feature is available from agent version 2.2.

Configuration Steps for Java Agent

  1. As a prerequisite, apminsight-javaagent.zip needs to be downloaded from your Site24x7 account. It comprises of agent jar with its associated files and the apminsight-javaagent-api.jar
  2. Include the apminsight-javaagent-api.jar file to the project build path and also ensure this file is exported along with other libraries of the application.
  3. Java agent API library provides two annotations which can be used in your application to track the performance of your custom classes and methods.
  • @ApmTracker: Can be used upon any classes and methods, which will be instrumented and included in the traces.
  • @ApmRootTracker: Can be used only on methods, which are likely to be the entry point method of the transaction(background).

@ApmTracker

Attributes:

  • component - Optional attribute

Defines the custom component for annotated classes/methods.

  • name - Optional attribute

A custom name for the annotated element, which will be prepended to actual method name.
Method parameters can be used for custom name by mentioning the argument index(starts at 1) with prefix '$'. 

Input params

The instrumented methods and its custom names can be viewed under Traces.

Final Output

@ApmRootTracker

Attributes

  • component - Optional attribute

Defines the custom component for annotated methods.

  • name - Optional attribute

A custom name for the annotated element, which will be prepended to actual method name.
Method parameters can be used for custom name by mentioning the argument index(starts at 1) with prefix '$'.

  • txnName - Mandatory

Defines the name for the background transaction, only if the method is the entry point of the transaction else it will be tracked as generic method and added to the traces.

Input params

The transaction is named according to the value specified for the attribute txnName.

Final Output



Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help APM APM for Java Custom Instrumentation Using Java Annotations