Help Docs

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.

Note

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 '$'. 

 

 

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

 

 

@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.

 

 

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

 

 

 

 

Was this document helpful?

Would you like to help us improve our documents? Tell us what you think we could do better.


We're sorry to hear that you're not satisfied with the document. We'd love to learn what we could do to improve the experience.


Thanks for taking the time to share your feedback. We'll use your feedback to improve our online help resources.

Shortlink has been copied!