in safeguard-impl/src/main/java/org/apache/safeguard/impl/timeout/TimeoutInterceptor.java [149:162]
public Model create(final InvocationContext context) {
final Timeout timeout = mapper.map(finder.findAnnotation(Timeout.class, context), context.getMethod(), Timeout.class);
if (timeout.value() < 0) {
throw new FaultToleranceDefinitionException("Timeout can't be < 0: " + context.getMethod());
}
final String metricsNameBase = "ft." + context.getMethod().getDeclaringClass().getCanonicalName() + "." +
context.getMethod().getName() + ".timeout.";
return new Model(
!mapper.isEnabled(context.getMethod(), Timeout.class),
timeout.unit().getDuration().toNanos() * timeout.value(),
metrics.histogram(metricsNameBase + "executionDuration", "Histogram of execution times for the method"),
metrics.counter(metricsNameBase + "callsTimedOut.total", "The number of times the method timed out"),
metrics.counter(metricsNameBase + "callsNotTimedOut.total", "The number of times the method completed without timing out"));
}