com.nitorcreations.willow.metrics.RequestDurationMetric Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of willow-servers Show documentation
Show all versions of willow-servers Show documentation
Willow operational servlets and servers
The newest version!
package com.nitorcreations.willow.metrics;
import static com.nitorcreations.willow.metrics.MetricUtils.median;
import java.util.List;
import javax.inject.Named;
import com.nitorcreations.willow.messages.metrics.MetricConfig;
@Named("/latency")
public class RequestDurationMetric extends SimpleMetric {
@Override
public String getType() {
return "access";
}
@Override
public String[] requiresFields() {
return new String[] { "duration" };
}
@Override
protected Long estimateValue(List preceeding, long stepTime, long stepLen, MetricConfig conf) {
return median(preceeding);
}
@Override
protected Long fillMissingValue() {
return 0L;
}
}