in modules/performance-statistics-ext/src/main/java/org/apache/ignite/internal/performancestatistics/handlers/QueryHandler.java [349:406]
private void buildTopSlowResult(GridCacheQueryType type, ArrayNode jsonRes) {
if (!topSlow.containsKey(type))
return;
OrderedFixedSizeStructure<Long, Query> tree = topSlow.get(type);
tree.values().forEach(query -> {
ObjectNode json = MAPPER.createObjectNode();
json.put("text", query.text);
json.put("startTime", query.startTime);
json.put("duration", TimeUnit.NANOSECONDS.toMillis(query.duration));
json.put("nodeId", String.valueOf(query.queryNodeId));
json.put("success", query.success);
json.put("logicalReads", 0);
json.put("physicalReads", 0);
jsonRes.add(json);
if (readsById.containsKey(type) && readsById.get(type).containsKey(query.queryNodeId)) {
long[] readsArr = readsById.get(type).get(query.queryNodeId).get(query.id);
if (readsArr != null) {
json.put("logicalReads", readsArr[0]);
json.put("physicalReads", readsArr[1]);
}
}
if (type == GridCacheQueryType.SQL_FIELDS) {
if (propsById.containsKey(query.queryNodeId) && propsById.get(query.queryNodeId).containsKey(query.id)) {
ArrayNode node = MAPPER.createArrayNode();
Collection<T3<String, String, long[]>> props = propsById.get(query.queryNodeId).get(query.id).values();
props.forEach(prop -> {
ObjectNode valCntNode = MAPPER.createObjectNode();
valCntNode.put("name", prop.get1());
valCntNode.put("value", prop.get2());
valCntNode.put("count", prop.get3()[0]);
node.add(valCntNode);
});
json.putIfAbsent("properties", node);
}
if (rowsById.containsKey(query.queryNodeId) && rowsById.get(query.queryNodeId).containsKey(query.id)) {
ObjectNode node = MAPPER.createObjectNode();
Map<String, long[]> rows = rowsById.get(query.queryNodeId).get(query.id);
rows.forEach((action, rowsCnt) -> node.put(action, rowsCnt[0]));
json.putIfAbsent("rows", node);
}
}
});
}