diff options
author | Geir Storli <geirst@oath.com> | 2018-02-22 17:07:18 +0100 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-02-22 17:07:18 +0100 |
commit | 75519e0e6f6b9d77ad3796367203c6f41e3ae9d6 (patch) | |
tree | 10ec95318849934b96a203ff34f77b4a6016652e /clustercontroller-core | |
parent | 92553c74190b24aba862bcd8c91815eb4649e43e (diff) |
Remove never used distributor-put-latency metrics from restapiv2.
Diffstat (limited to 'clustercontroller-core')
13 files changed, 0 insertions, 327 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java index 0ff59c26c13..74ddd941afb 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java @@ -165,19 +165,6 @@ public class ContentCluster { } } - public StorageNodeStats getStorageNodeStats(int storageNodeIndex) { - LatencyStats aggregatePutLatencyStats = new LatencyStats(); - StorageNodeStats aggregateStats = new StorageNodeStats(aggregatePutLatencyStats); - for (DistributorNodeInfo distributor : clusterInfo.getDistributorNodeInfo()) { - StorageNodeStats statsFromDistributor = distributor.getStorageNodeStatsOrNull(storageNodeIndex); - if (statsFromDistributor != null) { - aggregateStats.add(statsFromDistributor); - } - } - - return aggregateStats; - } - /** * Checks if a node can be upgraded * diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/DistributorNodeInfo.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/DistributorNodeInfo.java index 575b965c0e5..a21fbd22213 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/DistributorNodeInfo.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/DistributorNodeInfo.java @@ -15,28 +15,8 @@ import com.yahoo.vespa.clustercontroller.core.hostinfo.StorageNodeStatsBridge; */ public class DistributorNodeInfo extends NodeInfo { - private StorageNodeStatsContainer storageNodeStatsContainer = null; - public DistributorNodeInfo(ContentCluster cluster, int index, String rpcAddress, Distribution distribution) { super(cluster, new Node(NodeType.DISTRIBUTOR, index), false, rpcAddress, distribution); } - @Override - public void setHostInfo(HostInfo hostInfo) { - // This affects getHostInfo(), and makes the host info available through NodeInfo. - super.setHostInfo(hostInfo); - storageNodeStatsContainer = StorageNodeStatsBridge.traverseHostInfo(hostInfo); - } - - /** - * @return Stats this distributor has about a storage node, or null if unknown. - */ - public StorageNodeStats getStorageNodeStatsOrNull(int storageNodeIndex) { - if (storageNodeStatsContainer == null) { - return null; - } - - return storageNodeStatsContainer.get(storageNodeIndex); - } - } diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/LatencyStats.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/LatencyStats.java deleted file mode 100644 index 581cc244a20..00000000000 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/LatencyStats.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.clustercontroller.core; - -/** - * LatencyStats handles adding latencies and counts. - * - * @author hakonhall - */ -public class LatencyStats { - - private long latencyMsSum; - private long count; - - public LatencyStats() { this(0, 0); } - - /** - * @param latencyMsSum The sum of the latencies of all RPCs (or whatever) in milliseconds. - * @param count The number of RPC calls (or whatever). - */ - public LatencyStats(long latencyMsSum, long count) { - this.latencyMsSum = latencyMsSum; - this.count = count; - } - - void add(LatencyStats latencyToAdd) { - latencyMsSum += latencyToAdd.latencyMsSum; - count += latencyToAdd.count; - } - - public long getLatencyMsSum() { return latencyMsSum; } - public long getCount() { return count; } - -} diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StatsForStorageNodes.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StatsForStorageNodes.java deleted file mode 100644 index 8df5820bc49..00000000000 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StatsForStorageNodes.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.clustercontroller.core; - -import java.util.Map; - -/** - * Contains stats for a set of storage nodes. This is used to store the stats returned - * by Distributors from their getnodestate RPCs. The stats for a single storage node - * is represented by the StorageNodeStats class. - * - * @author hakonhall - */ -public class StatsForStorageNodes { - - final private Map<Integer, StorageNodeStats> storageNodesByIndex; - - StatsForStorageNodes(Map<Integer, StorageNodeStats> storageNodesByIndex) { - this.storageNodesByIndex = storageNodesByIndex; - } - - StorageNodeStats getStatsForStorageNode(int nodeIndex) { - return storageNodesByIndex.get(nodeIndex); - } - -} diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStats.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStats.java deleted file mode 100644 index d0afc1fa4b7..00000000000 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStats.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.clustercontroller.core; - -/** - * Contains stats related to a single storage node. - * - * @author hakonhall - */ -public class StorageNodeStats { - - final private LatencyStats distributorPutLatency; - - /** - * @param distributorPutLatency the "put" latency from the point of view of the distributor. - */ - public StorageNodeStats(LatencyStats distributorPutLatency) { this.distributorPutLatency = distributorPutLatency; } - public LatencyStats getDistributorPutLatency() { return distributorPutLatency; } - public void add(StorageNodeStats statsToAdd) { - distributorPutLatency.add(statsToAdd.distributorPutLatency); - } - -} diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsContainer.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsContainer.java deleted file mode 100644 index 1fb24e72218..00000000000 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsContainer.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.clustercontroller.core; - -import java.util.HashMap; -import java.util.Map; - -/** - * Contains stats for a set of storage nodes. This is used to store the stats returned - * by Distributors from their getnodestate RPCs. The stats for a single storage node - * is represented by the StorageNodeStats class. - * - * @author hakonhall - */ -public class StorageNodeStatsContainer { - - final private Map<Integer, StorageNodeStats> storageNodesByIndex = new HashMap<>(); - - public void put(int nodeIndex, StorageNodeStats nodeStats) { - storageNodesByIndex.put(nodeIndex, nodeStats); - } - - public StorageNodeStats get(int nodeIndex) { - return storageNodesByIndex.get(nodeIndex); - } - - public int size() { return storageNodesByIndex.size(); } - -} diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java index 55b7e4bb8c1..30ef0c69fe3 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java @@ -16,31 +16,6 @@ public class StorageNodeStatsBridge { private StorageNodeStatsBridge() { } - public static StorageNodeStatsContainer traverseHostInfo(HostInfo hostInfo) { - StorageNodeStatsContainer container = new StorageNodeStatsContainer(); - List<StorageNode> storageNodes = hostInfo.getDistributor().getStorageNodes(); - for (StorageNode storageNode : storageNodes) { - Integer storageNodeIndex = storageNode.getIndex(); - if (storageNodeIndex == null) { - continue; - } - StorageNode.OpsLatency opsLatency = storageNode.getOpsLatenciesOrNull(); - if (opsLatency == null) { - continue; - } - StorageNode.Put putLatency = opsLatency.getPut(); - Long putLatencyMsSum = putLatency.getLatencyMsSum(); - Long putLatencyCount = putLatency.getCount(); - if (putLatencyMsSum == null || putLatencyCount == null) { - continue; - } - LatencyStats putLatencyStats = new LatencyStats(putLatencyMsSum, putLatencyCount); - StorageNodeStats nodeStats = new StorageNodeStats(putLatencyStats); - container.put(storageNodeIndex, nodeStats); - } - return container; - } - public static ContentClusterStats generate(Distributor distributor) { Map<Integer, ContentNodeStats> mapToNodeStats = new HashMap<>(); for (StorageNode storageNode : distributor.getStorageNodes()) { diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/NodeStateRequest.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/NodeStateRequest.java index 9c7143aed4a..669042c2fd8 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/NodeStateRequest.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/NodeStateRequest.java @@ -1,10 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.core.restapiv2.requests; -import com.yahoo.vespa.clustercontroller.core.LatencyStats; import com.yahoo.vespa.clustercontroller.core.NodeInfo; import com.yahoo.vespa.clustercontroller.core.RemoteClusterControllerTask; -import com.yahoo.vespa.clustercontroller.core.StorageNodeStats; import com.yahoo.vespa.clustercontroller.core.restapiv2.Id; import com.yahoo.vespa.clustercontroller.core.restapiv2.Request; import com.yahoo.vespa.clustercontroller.core.restapiv2.Response; @@ -41,13 +39,6 @@ public class NodeStateRequest extends Request<Response.NodeResponse> { result.addState("unit", new Response.UnitStateImpl(info.getReportedState())); result.addState("user", new Response.UnitStateImpl(info.getWantedState())); - if (info.isStorage() && verboseReports.contains(VerboseReport.STATISTICS)) { - StorageNodeStats storageStats = context.cluster.getStorageNodeStats(info.getNodeIndex()); - LatencyStats latencyStats = storageStats.getDistributorPutLatency(); - result.addMetric("distributor-put-latency-ms-sum", latencyStats.getLatencyMsSum()); - result.addMetric("distributor-put-latency-count", latencyStats.getCount()); - } - for (int i=0; i<info.getReportedState().getDiskCount(); ++i) { Id.Partition partitionId = new Id.Partition(id, i); if (recursive > 0) { diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StatsForStorageNodeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StatsForStorageNodeTest.java deleted file mode 100644 index 2e88c147095..00000000000 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StatsForStorageNodeTest.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.clustercontroller.core; - -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -/** - * @author hakonhall - */ -public class StatsForStorageNodeTest { - @Test - public void testStatsForStorage() { - Map<Integer, StorageNodeStats> statsMap = new HashMap<>(); - - LatencyStats putLatencyForA = new LatencyStats(1, 2); - StorageNodeStats nodeStatsForA = new StorageNodeStats(putLatencyForA); - statsMap.put(5, nodeStatsForA); - - LatencyStats putLatencyForB = new LatencyStats(3, 4); - StorageNodeStats nodeStatsForB = new StorageNodeStats(putLatencyForB); - statsMap.put(6, nodeStatsForB); - - StatsForStorageNodes stats = new StatsForStorageNodes(statsMap); - - StorageNodeStats nodeStats = stats.getStatsForStorageNode(5); - assertNotNull(nodeStats); - assertEquals(1, nodeStatsForA.getDistributorPutLatency().getLatencyMsSum()); - assertEquals(2, nodeStatsForA.getDistributorPutLatency().getCount()); - - nodeStats = stats.getStatsForStorageNode(6); - assertNotNull(nodeStats); - assertEquals(3, nodeStatsForB.getDistributorPutLatency().getLatencyMsSum()); - assertEquals(4, nodeStatsForB.getDistributorPutLatency().getCount()); - - nodeStats = stats.getStatsForStorageNode(7); - assertNull(nodeStats); - } -} diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsContainerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsContainerTest.java deleted file mode 100644 index 5107792dbff..00000000000 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsContainerTest.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.clustercontroller.core; - -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -/** - * @author hakonhall - */ -public class StorageNodeStatsContainerTest { - @Test - public void testStatsForStorage() { - StorageNodeStatsContainer statsContainer = new StorageNodeStatsContainer(); - Map<Integer, StorageNodeStats> statsMap = new HashMap<>(); - - LatencyStats putLatencyForA = new LatencyStats(1, 2); - StorageNodeStats nodeStatsForA = new StorageNodeStats(putLatencyForA); - statsContainer.put(5, nodeStatsForA); - - LatencyStats putLatencyForB = new LatencyStats(3, 4); - StorageNodeStats nodeStatsForB = new StorageNodeStats(putLatencyForB); - statsContainer.put(6, nodeStatsForB); - - StorageNodeStats nodeStats = statsContainer.get(5); - assertNotNull(nodeStats); - assertEquals(1, nodeStatsForA.getDistributorPutLatency().getLatencyMsSum()); - assertEquals(2, nodeStatsForA.getDistributorPutLatency().getCount()); - - nodeStats = statsContainer.get(6); - assertNotNull(nodeStats); - assertEquals(3, nodeStatsForB.getDistributorPutLatency().getLatencyMsSum()); - assertEquals(4, nodeStatsForB.getDistributorPutLatency().getCount()); - - nodeStats = statsContainer.get(7); - assertNull(nodeStats); - } -} diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsTest.java deleted file mode 100644 index 4defb015e76..00000000000 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsTest.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.clustercontroller.core; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * @author hakonhall - */ -public class StorageNodeStatsTest { - @Test - public void testStorageNodeStats() { - LatencyStats putLatency = new LatencyStats(1, 2); - StorageNodeStats stats = new StorageNodeStats(putLatency); - assertEquals(1, stats.getDistributorPutLatency().getLatencyMsSum()); - assertEquals(2, stats.getDistributorPutLatency().getCount()); - - LatencyStats putLatencyToAdd = new LatencyStats(3, 4); - StorageNodeStats statsToAdd = new StorageNodeStats(putLatencyToAdd); - stats.add(statsToAdd); - assertEquals(1 + 3, stats.getDistributorPutLatency().getLatencyMsSum()); - assertEquals(2 + 4, stats.getDistributorPutLatency().getCount()); - } -} diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java index 5319d741503..51e73b333c5 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java @@ -3,8 +3,6 @@ package com.yahoo.vespa.clustercontroller.core.hostinfo; import com.yahoo.vespa.clustercontroller.core.ContentNodeStats; import com.yahoo.vespa.clustercontroller.core.ContentClusterStats; -import com.yahoo.vespa.clustercontroller.core.StorageNodeStats; -import com.yahoo.vespa.clustercontroller.core.StorageNodeStatsContainer; import org.junit.Test; import java.io.IOException; @@ -31,24 +29,6 @@ public class StorageNodeStatsBridgeTest { } @Test - public void testStorageNodeStatsContainer() throws IOException { - String data = getJsonString(); - HostInfo hostInfo = HostInfo.createHostInfo(data); - StorageNodeStatsContainer container = StorageNodeStatsBridge.traverseHostInfo(hostInfo); - assertEquals(2, container.size()); - - StorageNodeStats node0 = container.get(0); - assertNotNull(node0); - assertEquals(15, node0.getDistributorPutLatency().getLatencyMsSum()); - assertEquals(16, node0.getDistributorPutLatency().getCount()); - - StorageNodeStats node1 = container.get(1); - assertNotNull(node1); - assertEquals(17, node1.getDistributorPutLatency().getLatencyMsSum()); - assertEquals(18, node1.getDistributorPutLatency().getCount()); - } - - @Test public void testContentNodeStats() throws IOException { String data = getJsonString(); HostInfo hostInfo = HostInfo.createHostInfo(data); diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java index 1421e901048..de28867520b 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java @@ -60,14 +60,6 @@ public class NodeTest extends StateRestApiTest { " \"reason\": \"\"\n" + " }\n" + " },\n" + - " \"metrics\": {\n" + - // Why 24 and 28? There are 4 distributor nodes seen in slobrok (see StateRestApiTest). - // Each gets a host info with distributor-put-latency-ms-sum 6 and - // distributor-put-latency-count 7 (see StateRestApiTest.getHostInfo()). - // Therefore, in aggregate, 4*6 is 24, and 4*7 is 28. - " \"distributor-put-latency-ms-sum\": 24,\n" + - " \"distributor-put-latency-count\": 28\n" + - " },\n" + " \"partition\": {\n" + " \"0\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/1\\/0\"},\n" + " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/1\\/1\"}\n" + @@ -97,14 +89,6 @@ public class NodeTest extends StateRestApiTest { " \"reason\": \"\"\n" + " }\n" + " },\n" + - " \"metrics\": {\n" + - // Why 24 and 28? There are 4 distributor nodes seen in slobrok (see StateRestApiTest). - // Each gets a host info with distributor-put-latency-ms-sum 6 and - // distributor-put-latency-count 7 (see StateRestApiTest.getHostInfo()). - // Therefore, in aggregate, 4*6 is 24, and 4*7 is 28. - " \"distributor-put-latency-ms-sum\": 24,\n" + - " \"distributor-put-latency-count\": 28\n" + - " },\n" + " \"partition\": {\n" + " \"0\": {\n" + " \"state\": {\"generated\": {\n" + @@ -158,10 +142,6 @@ public class NodeTest extends StateRestApiTest { " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }\n" + - " },\n" + - " \"metrics\": {\n" + - " \"distributor-put-latency-ms-sum\": 0,\n" + - " \"distributor-put-latency-count\": 0\n" + " }\n" + "}"; assertEquals(expected, jsonWriter.createJson(response).toString(2)); |