Search in sources :

Example 1 with DistributionSummary

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());
}
Also used : Gauge(com.netflix.spectator.api.Gauge) Preconditions(com.netflix.spectator.impl.Preconditions) Tag(com.netflix.spectator.api.Tag) Counter(com.netflix.spectator.api.Counter) Set(java.util.Set) HashMap(java.util.HashMap) Deque(java.util.Deque) HttpEndpoint(com.netflix.iep.admin.HttpEndpoint) Id(com.netflix.spectator.api.Id) Collectors(java.util.stream.Collectors) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) Timer(com.netflix.spectator.api.Timer) Inject(javax.inject.Inject) List(java.util.List) Registry(com.netflix.spectator.api.Registry) Map(java.util.Map) Pattern(java.util.regex.Pattern) DistributionSummary(com.netflix.spectator.api.DistributionSummary) Measurement(com.netflix.spectator.api.Measurement) ArrayDeque(java.util.ArrayDeque) Gauge(com.netflix.spectator.api.Gauge) DistributionSummary(com.netflix.spectator.api.DistributionSummary) Counter(com.netflix.spectator.api.Counter) Timer(com.netflix.spectator.api.Timer) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HttpEndpoint (com.netflix.iep.admin.HttpEndpoint)1 Counter (com.netflix.spectator.api.Counter)1 DistributionSummary (com.netflix.spectator.api.DistributionSummary)1 Gauge (com.netflix.spectator.api.Gauge)1 Id (com.netflix.spectator.api.Id)1 Measurement (com.netflix.spectator.api.Measurement)1 Registry (com.netflix.spectator.api.Registry)1 Tag (com.netflix.spectator.api.Tag)1 Timer (com.netflix.spectator.api.Timer)1 Preconditions (com.netflix.spectator.impl.Preconditions)1 ArrayDeque (java.util.ArrayDeque)1 ArrayList (java.util.ArrayList)1 Deque (java.util.Deque)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1