Search in sources :

Example 1 with InstrumentedIndexSearcher

use of io.crate.execution.jobs.InstrumentedIndexSearcher in project crate by crate.

the class TransportJobAction method maybeInstrumentProfiler.

private SharedShardContexts maybeInstrumentProfiler(boolean enableProfiling, RootTask.Builder contextBuilder) {
    if (enableProfiling) {
        var profilers = new ArrayList<QueryProfiler>();
        ProfilingContext profilingContext = new ProfilingContext(profilers);
        contextBuilder.profilingContext(profilingContext);
        return new SharedShardContexts(indicesService, indexSearcher -> {
            var queryProfiler = new QueryProfiler();
            profilers.add(queryProfiler);
            return new InstrumentedIndexSearcher(indexSearcher, queryProfiler);
        });
    } else {
        return new SharedShardContexts(indicesService, UnaryOperator.identity());
    }
}
Also used : InstrumentedIndexSearcher(io.crate.execution.jobs.InstrumentedIndexSearcher) SharedShardContexts(io.crate.execution.jobs.SharedShardContexts) ArrayList(java.util.ArrayList) ProfilingContext(io.crate.profile.ProfilingContext) QueryProfiler(org.elasticsearch.search.profile.query.QueryProfiler)

Example 2 with InstrumentedIndexSearcher

use of io.crate.execution.jobs.InstrumentedIndexSearcher in project crate by crate.

the class JobLauncher method maybeInstrumentProfiler.

private SharedShardContexts maybeInstrumentProfiler(RootTask.Builder builder) {
    if (enableProfiling) {
        var profilers = new ArrayList<QueryProfiler>();
        ProfilingContext profilingContext = new ProfilingContext(profilers);
        builder.profilingContext(profilingContext);
        return new SharedShardContexts(indicesService, indexSearcher -> {
            var queryProfiler = new QueryProfiler();
            profilers.add(queryProfiler);
            return new InstrumentedIndexSearcher(indexSearcher, queryProfiler);
        });
    } else {
        return new SharedShardContexts(indicesService, UnaryOperator.identity());
    }
}
Also used : InstrumentedIndexSearcher(io.crate.execution.jobs.InstrumentedIndexSearcher) SharedShardContexts(io.crate.execution.jobs.SharedShardContexts) ArrayList(java.util.ArrayList) ProfilingContext(io.crate.profile.ProfilingContext) QueryProfiler(org.elasticsearch.search.profile.query.QueryProfiler)

Aggregations

InstrumentedIndexSearcher (io.crate.execution.jobs.InstrumentedIndexSearcher)2 SharedShardContexts (io.crate.execution.jobs.SharedShardContexts)2 ProfilingContext (io.crate.profile.ProfilingContext)2 ArrayList (java.util.ArrayList)2 QueryProfiler (org.elasticsearch.search.profile.query.QueryProfiler)2