Add threads and thread pools
We can add threads or thread pools to the Performance Measurement tool to ensure that generated reports include the data that you require for analysis. If you add a thread or complete parts of an operation on a thread pool, propagate the ID of the parent operation to produce valid caller and stack reports. Use the following sample code to help us create custom code to propagate the parent operation ID when you start a new thread:
* Sample to show how to propagate the parent operation identifier when * starting a new thread. * * @throws InterruptedException * unexpected */ public void startThreadSample() throws InterruptedException { // propagate the call hierarchy across threads or thread pool final Long parentID = OperationMetric .getThreadParentOperationIdentifier(); Thread myThread = new Thread(new Runnable() { @Override public void run() { OperationMetric.setThreadParentOperationIdentifier(parentID); // perform work } }); myThread.start(); myThread.join(); }
Related tasks
Adding tracing requests across servers
Related reference
Performance measurement loggers
Adding cache measurement metric points