Whether to return full precision from the timer (default: true). If false, values are rounded to 2 decimals.
Stops the timer associated with req and returns the elapsed time.
Also performs cleanup of the entry in the internal map.
The same Request used in startTimer.
Elapsed time in ms; null if no timer is found.
Starts the request timer and injects the generated requestId into the header.
The Request instance to be measured.
Creates a per-request timer controller using a generated
requestIdstored in the request header to correlate request/response.Ideal usage: middlewares or interceptors, where
startTimer(req)is invoked before the outbound call andgetTime(req)after the response arrives.Flow:
startTimer(req): generates arequestId, injects it into the header and starts the timer.getTime(req): reads therequestIdfrom the header, stops the timer, performs cleanup and returns the elapsed time.Notes:
stop()to avoid leaks.