Class TraceTiming
java.lang.Object
org.pipservices3.components.trace.TraceTiming
Timing object returned by
ITracer.beginTrace(java.lang.String, java.lang.String, java.lang.String) to end timing
of execution block and record the associated trace.
### Example ###
TraceTiming timing = tracer.beginTrace("mymethod.exec_time");
try {
...
timing.endTrace();
} catch (Exception err) {
timing.endFailure(err);
}
-
Constructor Summary
ConstructorsConstructorDescriptionTraceTiming(String correlationId, String component, String operation) TraceTiming(String correlationId, String component, String operation, ITracer tracer) Creates a new instance of the timing callback object. -
Method Summary
Modifier and TypeMethodDescriptionvoidendFailure(Exception error) Ends timing of a failed block, calculates elapsed time and records the associated trace.voidendTrace()Ends timing of an execution block, calculates elapsed time and records the associated trace.
-
Constructor Details
-
TraceTiming
-
TraceTiming
Creates a new instance of the timing callback object.- Parameters:
correlationId- (optional) transaction id to trace execution through call chain.component- an associated component nameoperation- an associated operation nametracer- a callback that shall be called when endTiming is called.
-
-
Method Details
-
endTrace
public void endTrace()Ends timing of an execution block, calculates elapsed time and records the associated trace. -
endFailure
Ends timing of a failed block, calculates elapsed time and records the associated trace.- Parameters:
error- an error object associated with this trace.
-