Java源码示例:io.micrometer.core.instrument.noop.NoopFunctionTimer
示例1
@Override
FunctionTimer newNoopMeter() {
return new NoopFunctionTimer(getId());
}
示例2
public FunctionTimerMetricsConverterTest() {
super(new NoopFunctionTimer(ID), new FunctionTimerMetricsConverter());
}
示例3
@Override
protected <T> FunctionTimer newFunctionTimer(final Meter.Id id, final T obj, final ToLongFunction<T> countFunction, final ToDoubleFunction<T> totalTimeFunction, final TimeUnit totalTimeFunctionUnits) {
return new NoopFunctionTimer(id);
}
示例4
@Override
protected <T> FunctionTimer newFunctionTimer(Id id, T obj, ToLongFunction<T> countFunction,
ToDoubleFunction<T> totalTimeFunction,
TimeUnit totalTimeFunctionUnits) {
return new NoopFunctionTimer(id);
}
示例5
/**
* A timer that tracks monotonically increasing functions for count and totalTime.
*
* @param id The identifier for this function timer.
* @param obj State object used to compute a value.
* @param countFunction Function that produces a monotonically increasing counter value from the state object.
* @param totalTimeFunction Function that produces a monotonically increasing total time value from the state object.
* @param totalTimeFunctionUnit The base unit of time produced by the total time function.
* @param <T> The type of the state object from which the function values are extracted.F
* @return A new or existing function timer.
*/
<T> FunctionTimer timer(Meter.Id id, T obj,
ToLongFunction<T> countFunction,
ToDoubleFunction<T> totalTimeFunction,
TimeUnit totalTimeFunctionUnit) {
return registerMeterIfNecessary(FunctionTimer.class, id, id2 -> {
Meter.Id withUnit = id2.withBaseUnit(getBaseTimeUnitStr());
return newFunctionTimer(withUnit, obj, countFunction, totalTimeFunction, totalTimeFunctionUnit);
}, NoopFunctionTimer::new);
}