com.nitorcreations.willow.metrics.ConnectionsMetric 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 java.util.Collections;
import java.util.List;
import javax.inject.Named;
import com.nitorcreations.willow.messages.metrics.MetricConfig;
@Named("/tcpinfo")
public class ConnectionsMetric extends SimpleMetric {
@Override
public String getType() {
return "tcpinfo";
}
@Override
public String[] requiresFields() {
return new String[] { "tcpInboundTotal", "tcpOutboundTotal" };
}
@Override
protected Integer getValue(List arr) {
return (arr.get(0).intValue() + arr.get(1).intValue());
}
@Override
protected Integer estimateValue(List preceeding, long stepTime, long stepLen, MetricConfig conf) {
return Collections.max(preceeding);
}
@Override
protected Integer fillMissingValue() {
return 0;
}
}