/** Sole constructor. This {@link Profilers} instance will initially wrap one {@link QueryProfiler}. */ public Profilers(ContextIndexSearcher searcher) { this.searcher = searcher; this.queryProfilers = new ArrayList<>(); this.aggProfiler = new AggregationProfiler(); addQueryProfiler(); }
@Override public AggregationProfileBreakdown getQueryBreakdown(Aggregator agg) { List<String> path = getAggregatorPath(agg); AggregationProfileBreakdown aggregationProfileBreakdown = profileBrakdownLookup.get(path); if (aggregationProfileBreakdown == null) { aggregationProfileBreakdown = super.getQueryBreakdown(agg); profileBrakdownLookup.put(path, aggregationProfileBreakdown); } return aggregationProfileBreakdown; }
@Override public void preCollection() throws IOException { this.profileBreakdown = profiler.getQueryBreakdown(delegate); Timer timer = profileBreakdown.getTimer(AggregationTimingType.INITIALIZE); timer.start(); try { delegate.preCollection(); } finally { timer.stop(); } profiler.pollLastElement(); }
/** * Helper method to convert Profiler into InternalProfileShardResults, which * can be serialized to other nodes, emitted as JSON, etc. * * @param profilers * The {@link Profilers} to convert into results * @return A {@link ProfileShardResult} representing the results for this * shard */ public static ProfileShardResult buildShardResults(Profilers profilers) { List<QueryProfiler> queryProfilers = profilers.getQueryProfilers(); AggregationProfiler aggProfiler = profilers.getAggregationProfiler(); List<QueryProfileShardResult> queryResults = new ArrayList<>(queryProfilers.size()); for (QueryProfiler queryProfiler : queryProfilers) { QueryProfileShardResult result = new QueryProfileShardResult(queryProfiler.getTree(), queryProfiler.getRewriteTime(), queryProfiler.getCollector()); queryResults.add(result); } AggregationProfileShardResult aggResults = new AggregationProfileShardResult(aggProfiler.getTree()); return new ProfileShardResult(queryResults, aggResults); } }
/** * Helper method to convert Profiler into InternalProfileShardResults, which * can be serialized to other nodes, emitted as JSON, etc. * * @param profilers * The {@link Profilers} to convert into results * @return A {@link ProfileShardResult} representing the results for this * shard */ public static ProfileShardResult buildShardResults(Profilers profilers) { List<QueryProfiler> queryProfilers = profilers.getQueryProfilers(); AggregationProfiler aggProfiler = profilers.getAggregationProfiler(); List<QueryProfileShardResult> queryResults = new ArrayList<>(queryProfilers.size()); for (QueryProfiler queryProfiler : queryProfilers) { QueryProfileShardResult result = new QueryProfileShardResult(queryProfiler.getTree(), queryProfiler.getRewriteTime(), queryProfiler.getCollector()); queryResults.add(result); } AggregationProfileShardResult aggResults = new AggregationProfileShardResult(aggProfiler.getTree()); return new ProfileShardResult(queryResults, aggResults); } }
@Override public void preCollection() throws IOException { this.profileBreakdown = profiler.getQueryBreakdown(delegate); Timer timer = profileBreakdown.getTimer(AggregationTimingType.INITIALIZE); timer.start(); try { delegate.preCollection(); } finally { timer.stop(); } profiler.pollLastElement(); }
@Override public AggregationProfileBreakdown getQueryBreakdown(Aggregator agg) { List<String> path = getAggregatorPath(agg); AggregationProfileBreakdown aggregationProfileBreakdown = profileBrakdownLookup.get(path); if (aggregationProfileBreakdown == null) { aggregationProfileBreakdown = super.getQueryBreakdown(agg); profileBrakdownLookup.put(path, aggregationProfileBreakdown); } return aggregationProfileBreakdown; }
/** Sole constructor. This {@link Profilers} instance will initially wrap one {@link QueryProfiler}. */ public Profilers(ContextIndexSearcher searcher) { this.searcher = searcher; this.queryProfilers = new ArrayList<>(); this.aggProfiler = new AggregationProfiler(); addQueryProfiler(); }
/** * Helper method to convert Profiler into InternalProfileShardResults, which * can be serialized to other nodes, emitted as JSON, etc. * * @param profilers * The {@link Profilers} to convert into results * @return A {@link ProfileShardResult} representing the results for this * shard */ public static ProfileShardResult buildShardResults(Profilers profilers) { List<QueryProfiler> queryProfilers = profilers.getQueryProfilers(); AggregationProfiler aggProfiler = profilers.getAggregationProfiler(); List<QueryProfileShardResult> queryResults = new ArrayList<>(queryProfilers.size()); for (QueryProfiler queryProfiler : queryProfilers) { QueryProfileShardResult result = new QueryProfileShardResult(queryProfiler.getTree(), queryProfiler.getRewriteTime(), queryProfiler.getCollector()); queryResults.add(result); } AggregationProfileShardResult aggResults = new AggregationProfileShardResult(aggProfiler.getTree()); return new ProfileShardResult(queryResults, aggResults); } }
@Override public void preCollection() throws IOException { this.profileBreakdown = profiler.getQueryBreakdown(delegate); Timer timer = profileBreakdown.getTimer(AggregationTimingType.INITIALIZE); timer.start(); try { delegate.preCollection(); } finally { timer.stop(); } profiler.pollLastElement(); }
@Override public AggregationProfileBreakdown getQueryBreakdown(Aggregator agg) { List<String> path = getAggregatorPath(agg); AggregationProfileBreakdown aggregationProfileBreakdown = profileBrakdownLookup.get(path); if (aggregationProfileBreakdown == null) { aggregationProfileBreakdown = super.getQueryBreakdown(agg); profileBrakdownLookup.put(path, aggregationProfileBreakdown); } return aggregationProfileBreakdown; }
/** Sole constructor. This {@link Profilers} instance will initially wrap one {@link QueryProfiler}. */ public Profilers(ContextIndexSearcher searcher) { this.searcher = searcher; this.queryProfilers = new ArrayList<>(); this.aggProfiler = new AggregationProfiler(); addQueryProfiler(); }
/** * Helper method to convert Profiler into InternalProfileShardResults, which * can be serialized to other nodes, emitted as JSON, etc. * * @param profilers * The {@link Profilers} to convert into results * @return A {@link ProfileShardResult} representing the results for this * shard */ public static ProfileShardResult buildShardResults(Profilers profilers) { List<QueryProfiler> queryProfilers = profilers.getQueryProfilers(); AggregationProfiler aggProfiler = profilers.getAggregationProfiler(); List<QueryProfileShardResult> queryResults = new ArrayList<>(queryProfilers.size()); for (QueryProfiler queryProfiler : queryProfilers) { QueryProfileShardResult result = new QueryProfileShardResult(queryProfiler.getTree(), queryProfiler.getRewriteTime(), queryProfiler.getCollector()); queryResults.add(result); } AggregationProfileShardResult aggResults = new AggregationProfileShardResult(aggProfiler.getTree()); return new ProfileShardResult(queryResults, aggResults); } }
@Override public void preCollection() throws IOException { this.profileBreakdown = profiler.getQueryBreakdown(delegate); Timer timer = profileBreakdown.getTimer(AggregationTimingType.INITIALIZE); timer.start(); try { delegate.preCollection(); } finally { timer.stop(); } profiler.pollLastElement(); }
@Override public AggregationProfileBreakdown getQueryBreakdown(Aggregator agg) { List<String> path = getAggregatorPath(agg); AggregationProfileBreakdown aggregationProfileBreakdown = profileBrakdownLookup.get(path); if (aggregationProfileBreakdown == null) { aggregationProfileBreakdown = super.getQueryBreakdown(agg); profileBrakdownLookup.put(path, aggregationProfileBreakdown); } return aggregationProfileBreakdown; }
/** Sole constructor. This {@link Profilers} instance will initially wrap one {@link QueryProfiler}. */ public Profilers(ContextIndexSearcher searcher) { this.searcher = searcher; this.queryProfilers = new ArrayList<>(); this.aggProfiler = new AggregationProfiler(); addQueryProfiler(); }