summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahoo-inc.com>2017-03-01 13:04:16 +0100
committerBjørn Christian Seime <bjorncs@yahoo-inc.com>2017-03-01 14:06:22 +0100
commitca768b2e7ed83339d8725aecf70789631c653a22 (patch)
treef4b87f6c4415d2b46380fa9c73cf0917d1971604 /container-search
parentbe31c1f94e902d4bc6aa5bcf7d9bec358bb4a784 (diff)
Store streaming stats in query instead of query context
All properties in the query context are modelled as trace nodes and will be part of the query trace regardless of level. The streaming statistics should only be visible in trace for levels >=2.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/vespa/streamingvisitors/MetricsSearcher.java13
-rw-r--r--container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java7
-rw-r--r--container-search/src/test/java/com/yahoo/vespa/streamingvisitors/MetricsSearcherTestCase.java4
3 files changed, 10 insertions, 14 deletions
diff --git a/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/MetricsSearcher.java b/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/MetricsSearcher.java
index 3d795674039..ad42d560b94 100644
--- a/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/MetricsSearcher.java
+++ b/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/MetricsSearcher.java
@@ -2,13 +2,12 @@
package com.yahoo.vespa.streamingvisitors;
import com.yahoo.log.event.Event;
-import com.yahoo.search.query.context.QueryContext;
-import com.yahoo.search.result.ErrorMessage;
-import com.yahoo.search.searchchain.Execution;
+import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
-import com.yahoo.processing.request.CompoundName;
+import com.yahoo.search.result.ErrorMessage;
+import com.yahoo.search.searchchain.Execution;
import com.yahoo.vdslib.VisitorStatistics;
import java.util.Map;
@@ -77,11 +76,7 @@ public class MetricsSearcher extends Searcher {
stats.ok++;
}
- VisitorStatistics visitorstats = null;
- final QueryContext queryContext = query.getContext(false);
- if (queryContext != null) {
- visitorstats = (VisitorStatistics)queryContext.getProperty(STREAMING_STATISTICS);
- }
+ VisitorStatistics visitorstats = (VisitorStatistics) query.properties().get(STREAMING_STATISTICS);
if (visitorstats != null) {
stats.dataStreamed += visitorstats.getBytesVisited();
stats.documentsStreamed += visitorstats.getDocumentsVisited();
diff --git a/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java b/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java
index a84a1a545b6..56de88fa843 100644
--- a/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java
+++ b/container-search/src/main/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcher.java
@@ -26,6 +26,7 @@ import com.yahoo.search.searchchain.Execution;
import com.yahoo.searchlib.aggregation.Grouping;
import com.yahoo.vdslib.DocumentSummary;
import com.yahoo.vdslib.SearchResult;
+import com.yahoo.vdslib.VisitorStatistics;
import java.io.IOException;
import java.math.BigInteger;
@@ -153,9 +154,9 @@ public class VdsStreamingSearcher extends VespaBackEndSearcher {
result.setTotalHitCount(visitor.getTotalHitCount());
- Execution.Trace traceChild = query.getContext(true).getTrace().createChild();
- traceChild.setTraceLevel(2);
- traceChild.setProperty(STREAMING_STATISTICS, visitor.getStatistics());
+ VisitorStatistics statistics = visitor.getStatistics();
+ query.trace(statistics.toString(), false, 2);
+ query.properties().set(STREAMING_STATISTICS, statistics);
Packet[] summaryPackets = new Packet [hits.size()];
diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/MetricsSearcherTestCase.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/MetricsSearcherTestCase.java
index 1fe62c2cd35..fab132c78b3 100644
--- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/MetricsSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/MetricsSearcherTestCase.java
@@ -132,9 +132,9 @@ public class MetricsSearcherTestCase {
private void assignContextProperties(Query query, String loadType) {
if (loadType != null && loadType.equals(LOADTYPE1)) {
- query.getContext(true).setProperty(VdsStreamingSearcher.STREAMING_STATISTICS, visitorStats);
+ query.properties().set(VdsStreamingSearcher.STREAMING_STATISTICS, visitorStats);
} else {
- query.getContext(true).setProperty(VdsStreamingSearcher.STREAMING_STATISTICS, null);
+ query.properties().set(VdsStreamingSearcher.STREAMING_STATISTICS, null);
}
}
}