diff options
author | Olli Virtanen <ovirtanen@gmail.com> | 2019-03-22 09:13:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-22 09:13:45 +0100 |
commit | 519d59334ca8c3e314e71f83de618e375a7c2d6c (patch) | |
tree | 0bfeb5aa0ba8e67b896a8a2826da138dbb39461e /container-search/src/test/java/com | |
parent | 7989191b378263162e31f5226710a0cc9e9c5799 (diff) | |
parent | 9f82c8ea00268f11d1f34687808c4bfe799f291f (diff) |
Merge pull request #8805 from vespa-engine/ollivir/java-dispatch-metrics
dispatch_internal and dispatch_fdispatch metrics
Diffstat (limited to 'container-search/src/test/java/com')
4 files changed, 32 insertions, 9 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java index 886fd86c5aa..1e19a1397e0 100644 --- a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java @@ -5,6 +5,8 @@ import com.yahoo.cloud.config.ClusterInfoConfig; import com.yahoo.component.ComponentId; import com.yahoo.container.QrConfig; import com.yahoo.container.QrSearchersConfig; +import com.yahoo.container.handler.VipStatus; +import com.yahoo.container.protect.Error; import com.yahoo.container.search.Fs4Config; import com.yahoo.fs4.QueryPacket; import com.yahoo.prelude.IndexFacts; @@ -14,12 +16,11 @@ import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig; import com.yahoo.prelude.fastsearch.FS4ResourcePool; import com.yahoo.prelude.fastsearch.FastHit; import com.yahoo.prelude.fastsearch.VespaBackEndSearcher; +import com.yahoo.prelude.fastsearch.test.MockMetric; import com.yahoo.search.Query; import com.yahoo.search.config.ClusterConfig; import com.yahoo.search.result.Hit; import com.yahoo.search.searchchain.Execution; -import com.yahoo.container.handler.VipStatus; -import com.yahoo.container.protect.Error; import com.yahoo.statistics.Statistics; import com.yahoo.vespa.config.search.DispatchConfig; import org.junit.Test; @@ -542,6 +543,7 @@ public class ClusterSearcherTestCase { new DispatchConfig.Builder().build(), createClusterInfoConfig(), Statistics.nullImplementation, + new MockMetric(), new FS4ResourcePool(new Fs4Config.Builder().build(), new QrConfig.Builder().build()), new VipStatus()); } diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java index 001c8d57759..6be895f33d2 100644 --- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java +++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java @@ -23,7 +23,7 @@ class MockDispatcher extends Dispatcher { public MockDispatcher(String clusterId, List<Node> nodes, FS4ResourcePool fs4ResourcePool, int containerClusterSize, VipStatus vipStatus) { - super(clusterId, toDispatchConfig(nodes), fs4ResourcePool, containerClusterSize, vipStatus); + super(clusterId, toDispatchConfig(nodes), fs4ResourcePool, containerClusterSize, vipStatus, new MockMetric()); } private static DispatchConfig toDispatchConfig(List<Node> nodes) { @@ -43,5 +43,4 @@ class MockDispatcher extends Dispatcher { public void fill(Result result, String summaryClass) { } - } diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockMetric.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockMetric.java new file mode 100644 index 00000000000..213a362edd5 --- /dev/null +++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockMetric.java @@ -0,0 +1,21 @@ +// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.prelude.fastsearch.test; + +import com.yahoo.jdisc.Metric; + +import java.util.Map; + +public class MockMetric implements Metric { + @Override + public void set(String key, Number val, Context ctx) { + } + + @Override + public void add(String key, Number val, Context ctx) { + } + + @Override + public Context createContext(Map<String, ?> properties) { + return null; + } +} diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java index 0cc58801298..859e10dbe2c 100644 --- a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java +++ b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java @@ -3,6 +3,7 @@ package com.yahoo.search.dispatch; import com.yahoo.prelude.fastsearch.FS4InvokerFactory; import com.yahoo.prelude.fastsearch.VespaBackEndSearcher; +import com.yahoo.prelude.fastsearch.test.MockMetric; import com.yahoo.processing.request.CompoundName; import com.yahoo.search.Query; import com.yahoo.search.dispatch.rpc.RpcInvokerFactory; @@ -38,7 +39,7 @@ public class DispatcherTest { builder.useMultilevelDispatch(true); DispatchConfig dc = new DispatchConfig(builder); - Dispatcher disp = new Dispatcher(cl, dc, new MockFS4InvokerFactory(cl), new MockRpcInvokerFactory()); + Dispatcher disp = new Dispatcher(cl, dc, new MockFS4InvokerFactory(cl), new MockRpcInvokerFactory(), new MockMetric()); assertThat(disp.getSearchInvoker(query(), null).isPresent(), is(false)); } @@ -52,7 +53,7 @@ public class DispatcherTest { assertThat(nodes.get(0).key(), is(2)); return true; }); - Dispatcher disp = new Dispatcher(cl, createDispatchConfig(), invokerFactory, new MockRpcInvokerFactory()); + Dispatcher disp = new Dispatcher(cl, createDispatchConfig(), invokerFactory, new MockRpcInvokerFactory(), new MockMetric()); Optional<SearchInvoker> invoker = disp.getSearchInvoker(q, null); assertThat(invoker.isPresent(), is(true)); invokerFactory.verifyAllEventsProcessed(); @@ -67,7 +68,7 @@ public class DispatcherTest { } }; MockFS4InvokerFactory invokerFactory = new MockFS4InvokerFactory(cl, (n, a) -> true); - Dispatcher disp = new Dispatcher(cl, createDispatchConfig(), invokerFactory, new MockRpcInvokerFactory()); + Dispatcher disp = new Dispatcher(cl, createDispatchConfig(), invokerFactory, new MockRpcInvokerFactory(), new MockMetric()); Optional<SearchInvoker> invoker = disp.getSearchInvoker(query(), null); assertThat(invoker.isPresent(), is(true)); invokerFactory.verifyAllEventsProcessed(); @@ -84,7 +85,7 @@ public class DispatcherTest { assertThat(acceptIncompleteCoverage, is(true)); return true; }); - Dispatcher disp = new Dispatcher(cl, createDispatchConfig(), invokerFactory, new MockRpcInvokerFactory()); + Dispatcher disp = new Dispatcher(cl, createDispatchConfig(), invokerFactory, new MockRpcInvokerFactory(), new MockMetric()); Optional<SearchInvoker> invoker = disp.getSearchInvoker(query(), null); assertThat(invoker.isPresent(), is(true)); invokerFactory.verifyAllEventsProcessed(); @@ -95,7 +96,7 @@ public class DispatcherTest { SearchCluster cl = new MockSearchCluster("1", 2, 1); MockFS4InvokerFactory invokerFactory = new MockFS4InvokerFactory(cl, (n, a) -> false, (n, a) -> false); - Dispatcher disp = new Dispatcher(cl, createDispatchConfig(), invokerFactory, null); + Dispatcher disp = new Dispatcher(cl, createDispatchConfig(), invokerFactory, null, new MockMetric()); Optional<SearchInvoker> invoker = disp.getSearchInvoker(query(), null); assertThat(invoker.isPresent(), is(false)); invokerFactory.verifyAllEventsProcessed(); |