use of com.netflix.spectator.api.DistributionSummary in project iep by Netflix.
the class SpectatorEndpoint method get.
@Override
public Object get(String path) {
Query q = Query.parse(path);
return registry.stream().filter(m -> !m.hasExpired()).flatMap(m -> {
List<Object> ms = new ArrayList<>();
Map<String, String> tags = toMap(m.id());
if (m instanceof Counter) {
add(q, tags, ms, new CounterInfo(tags, ((Counter) m).count()));
} else if (m instanceof Timer) {
Timer t = (Timer) m;
add(q, tags, ms, new TimerInfo(tags, t.totalTime(), t.count()));
} else if (m instanceof DistributionSummary) {
DistributionSummary t = (DistributionSummary) m;
add(q, tags, ms, new DistInfo(tags, t.totalAmount(), t.count()));
} else if (m instanceof Gauge) {
Gauge g = (Gauge) m;
add(q, tags, ms, new GaugeInfo(tags, g.value()));
}
return ms.stream();
}).collect(Collectors.toList());
}
Aggregations