Custom Instrumentation
Custom Instrumentation
APM Insight agent instruments predefined classes of several Web Components and Frameworks to provide insight into the application. APM Insight also provides an option to custom instrument, classes of your choice. Custom instrumentation helps in providing wider insight into applications, where it will be easier to track performance of specific features or modules in the application.
Java Agent provide 2 ways to custom instrument your application
Configuration Steps
- Open custom_instrumentation.conf file, in any text editor. If file not found, create a new file in the directory where the apminsight.conf exists.
- Add the classes/packages, as per the syntax provided below
Fully qualified ClassName : methodNames separated by comma(,) : component_Name
- Each entry of class/package must added in a new line
- If methodNames are not provided, all methods under the specified class will be instrumented. If there exists, overloading methods that needs to be instrumented, all the overloaded methods will be instrumented.
- Only a-zA-Z_0-9 characters are allowed for naming a component. If component_Name is not specified or invalid, by default agent considers it as POJO (Plain Java Object)
Example:
a/b/c/CustomClass : methodA, methodB : ComponentA
a/b/c/CustomClass : methodC : ComponentB
a/b/c/CustomClass : : Component_A1
a/b/c/CustomClass : :
- If all classes in a package needs to be instrumented, specify the package name as described below:
package_name/.* : :
Example:
a/b/c/.* : : Component_C
a/b/c/d/.* : :
- It is not recommended to specify the entire packages as input, as the agent will instrument all methods in all classes and all packages under it. These may cost extra overhead in CPU and memory usage. Also, there will be many methods that are of least interest and these makes the traces lengthy. Although it can be used to study the code flow.
Changes are not updated in runtime. It requires a application server restart for the changes to be effective.