Search in sources :

Example 1 with GridCacheQueryDetailMetricsAdapter

use of org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter in project ignite by apache.

the class VisorQueryDetailMetricsCollectorTask method reduce0.

/**
 * {@inheritDoc}
 */
@Nullable
@Override
protected Collection<VisorQueryDetailMetrics> reduce0(List<ComputeJobResult> results) throws IgniteException {
    Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> taskRes = new HashMap<>();
    for (ComputeJobResult res : results) {
        if (res.getException() != null)
            throw res.getException();
        Collection<GridCacheQueryDetailMetricsAdapter> metrics = res.getData();
        VisorCacheQueryDetailMetricsCollectorJob.aggregateMetrics(-1, taskRes, metrics);
    }
    Collection<GridCacheQueryDetailMetricsAdapter> aggMetrics = taskRes.values();
    Collection<VisorQueryDetailMetrics> res = new ArrayList<>(aggMetrics.size());
    for (GridCacheQueryDetailMetricsAdapter m : aggMetrics) res.add(new VisorQueryDetailMetrics(m));
    return res;
}
Also used : GridCacheQueryDetailMetricsKey(org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsKey) HashMap(java.util.HashMap) GridCacheQueryDetailMetricsAdapter(org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter) ArrayList(java.util.ArrayList) ComputeJobResult(org.apache.ignite.compute.ComputeJobResult) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ComputeJobResult (org.apache.ignite.compute.ComputeJobResult)1 GridCacheQueryDetailMetricsAdapter (org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter)1 GridCacheQueryDetailMetricsKey (org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsKey)1 Nullable (org.jetbrains.annotations.Nullable)1