As you learned in part 1th of this series (three articles), monitoring the availability and performance of Java applications and dependencies in production is critical to ensuring problem detection and accelerating problem diagnosis and repair. Source-code-level inserts for classes that need to be monitored have the advantages that are discussed in part 1th, but this method is often not available or impractical. For example, many of the monitoring points you are interested in may be in third party components, and the source code for Third-party components is unknown to you. In the 2nd part, I focused on ways to insert Java classes and resources without modifying the original source code.
Alternative methods of arranging inserts in the source code are: interception class packing byte code insert
This article uses the ITracer interface presented in part 1th to implement performance data tracking, illustrating these techniques in turn.
|
Back to the top of the page |
|
Java Inserts by intercepting
The basic premise of interception is the conversion of a particular invocation pattern through an interception construct and the collection of incoming inbound and outbound call information. The implementation of a basic interceptor will: Gets the current time of the request to the inbound call. Retrieves the current time of the outbound response. Calculates the run time as an increment of two measures. Submits the call's elapsed time to the application performance management (APM) system.
Figure 1 shows the process:
Figure 1. Basic process of performance data collection and interception program
This article has been transferred from IBM Developerworks China
Please click here to view the original