use of org.jboss.weld.probe.Queries.ObserverFilters in project core by weld.
the class JsonObjects method createBootstrapStatsJson.
static JsonArrayBuilder createBootstrapStatsJson(Probe probe) {
JsonArrayBuilder builder = Json.arrayBuilder();
Map<EventType, AtomicInteger> counts = probe.getBootstrapStats().getCounts();
List<EventType> sortedKeys = new ArrayList<>(counts.keySet());
Collections.sort(sortedKeys, new Comparator<EventType>() {
@Override
public int compare(EventType o1, EventType o2) {
return Integer.compare(o1.getPriority(), o2.getPriority());
}
});
for (EventType eventType : sortedKeys) {
JsonObjectBuilder eventBuilder = Json.objectBuilder();
eventBuilder.add(NAME, eventType.toString());
eventBuilder.add(TYPE, eventType.getType());
eventBuilder.add(FIRED, counts.get(eventType).get());
eventBuilder.add(OBSERVERS, Queries.find(probe.getObservers(), 1, 0, new ObserverFilters(probe, eventType.getType(), null)).getTotal());
builder.add(eventBuilder);
}
return builder;
}
Aggregations