Search in sources :

Example 1 with GroupData

use of fish.payara.monitoring.adapt.GroupData in project Payara by payara.

the class MonitoringConsoleRuntimeImpl method selectAll.

@Override
public Collection<GroupData> selectAll(String source, String group) {
    if (!"requesttracing".equals(source)) {
        return emptyList();
    }
    List<GroupData> matches = new ArrayList<>();
    for (RequestTrace trace : requestTracingService.getRequestTraceStore().getTraces()) {
        if (RequestTracingService.metricGroupName(trace).equals(group)) {
            GroupData data = new GroupData();
            data.addField("id", trace.getTraceId()).addField("startTime", trace.getStartTime().toEpochMilli()).addField("endTime", trace.getEndTime().toEpochMilli()).addField("elapsedTime", trace.getElapsedTime());
            for (RequestTraceSpan span : trace.getTraceSpans()) {
                GroupData tags = data.addChild(span.getId().toString()).addField("id", span.getId()).addField("operation", RequestTracingService.stripPackageName(span.getEventName())).addField("startTime", span.getTimeOccured()).addField("endTime", span.getTraceEndTime().toEpochMilli()).addField("duration", span.getSpanDuration()).addChild("tags");
                for (Entry<Object, String> tag : span.getSpanTags().entrySet()) {
                    if (tag.getKey() instanceof Tag) {
                        tags.addField(((Tag) tag.getKey()).getKey(), tag.getValue());
                    } else {
                        tags.addField(tag.getKey().toString(), tag.getValue());
                    }
                }
            }
            matches.add(data);
        }
    }
    return matches;
}
Also used : ArrayList(java.util.ArrayList) RequestTraceSpan(fish.payara.notification.requesttracing.RequestTraceSpan) RequestTrace(fish.payara.notification.requesttracing.RequestTrace) Tag(io.opentracing.tag.Tag) GroupData(fish.payara.monitoring.adapt.GroupData)

Aggregations

GroupData (fish.payara.monitoring.adapt.GroupData)1 RequestTrace (fish.payara.notification.requesttracing.RequestTrace)1 RequestTraceSpan (fish.payara.notification.requesttracing.RequestTraceSpan)1 Tag (io.opentracing.tag.Tag)1 ArrayList (java.util.ArrayList)1