Package net.morimekta.providence.util
Interface ServiceCallInstrumentation
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ServiceCallInstrumentation
Interface handling the instrumentation of service calls.
-
-
Field Summary
Fields Modifier and Type Field Description static long
NS_IN_MILLIS
Handy constant for calculating MS duration.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
onComplete(double duration, PServiceCall call, PServiceCall reply)
After each service call this method is called with the duration, call and response objects.default void
onTransportException(java.lang.Exception e, double duration, PServiceCall call, PServiceCall reply)
Called when the service call failed in the transport layer itself with something not related to the actual service call.
-
-
-
Method Detail
-
onComplete
void onComplete(double duration, @Nullable PServiceCall call, @Nullable PServiceCall reply)
After each service call this method is called with the duration, call and response objects. Exceptions from the call is ignored, and will not affect the response in any way.Note that the timing may not include the whole stack time since receiving the first packet, that is dependent on the specific implementation and the limitations there. E.g. it does not include the time receiving the first HTTP packet with the headers, or waiting for free worker threads when using
ProvidenceServlet
.- Parameters:
duration
- The duration of handling the service call in milliseconds, including receiving and sending it.call
- The call triggered.reply
- The reply returned.
-
onTransportException
default void onTransportException(java.lang.Exception e, double duration, @Nullable PServiceCall call, @Nullable PServiceCall reply)
Called when the service call failed in the transport layer itself with something not related to the actual service call. E.g. in server side when the read message failed, write back failed etc.onComplete(double, PServiceCall, PServiceCall)
will NOT be called after the exception call, but will be chained if this method has no override.- Parameters:
e
- The exception thrown.duration
- The duration of handling the service call in milliseconds, including receiving and sending it.call
- The service call.reply
- The service reply.
-
-