From 30892c41295144ad6e60cfee647cedf9e051ae46 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Mon, 6 Jul 2015 16:52:53 +0200 Subject: [PATCH] Remove network stats & info --- .../admin/cluster/node/info/NodeInfo.java | 25 +- .../cluster/node/info/NodesInfoResponse.java | 3 - .../admin/cluster/node/stats/NodeStats.java | 27 +- .../elasticsearch/monitor/MonitorModule.java | 5 - .../elasticsearch/monitor/MonitorService.java | 10 +- .../monitor/network/JmxNetworkProbe.java | 53 ---- .../monitor/network/NetworkInfo.java | 161 ------------ .../monitor/network/NetworkProbe.java | 32 --- .../monitor/network/NetworkService.java | 130 --------- .../monitor/network/NetworkStats.java | 248 ------------------ .../node/service/NodeService.java | 4 - .../decider/MockDiskUsagesTests.java | 2 +- .../stresstest/leaks/GenericStatsLeak.java | 3 - docs/reference/cluster/nodes-info.asciidoc | 2 +- docs/reference/cluster/nodes-stats.asciidoc | 5 +- .../rest-api-spec/api/nodes.info.json | 2 +- .../rest-api-spec/api/nodes.stats.json | 2 +- 17 files changed, 8 insertions(+), 706 deletions(-) delete mode 100644 core/src/main/java/org/elasticsearch/monitor/network/JmxNetworkProbe.java delete mode 100644 core/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java delete mode 100644 core/src/main/java/org/elasticsearch/monitor/network/NetworkProbe.java delete mode 100644 core/src/main/java/org/elasticsearch/monitor/network/NetworkService.java delete mode 100644 core/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java index f3c5eb7e1fc..5ac72d70b9c 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.http.HttpInfo; import org.elasticsearch.monitor.jvm.JvmInfo; -import org.elasticsearch.monitor.network.NetworkInfo; import org.elasticsearch.monitor.os.OsInfo; import org.elasticsearch.monitor.process.ProcessInfo; import org.elasticsearch.threadpool.ThreadPoolInfo; @@ -65,9 +64,6 @@ public class NodeInfo extends BaseNodeResponse { @Nullable private ThreadPoolInfo threadPool; - @Nullable - private NetworkInfo network; - @Nullable private TransportInfo transport; @@ -81,7 +77,7 @@ public class NodeInfo extends BaseNodeResponse { } public NodeInfo(Version version, Build build, DiscoveryNode node, @Nullable ImmutableMap serviceAttributes, @Nullable Settings settings, - @Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable NetworkInfo network, + @Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable TransportInfo transport, @Nullable HttpInfo http, @Nullable PluginsInfo plugins) { super(node); this.version = version; @@ -92,7 +88,6 @@ public class NodeInfo extends BaseNodeResponse { this.process = process; this.jvm = jvm; this.threadPool = threadPool; - this.network = network; this.transport = transport; this.http = http; this.plugins = plugins; @@ -165,14 +160,6 @@ public class NodeInfo extends BaseNodeResponse { return this.threadPool; } - /** - * Network level information. - */ - @Nullable - public NetworkInfo getNetwork() { - return network; - } - @Nullable public TransportInfo getTransport() { return transport; @@ -222,9 +209,6 @@ public class NodeInfo extends BaseNodeResponse { if (in.readBoolean()) { threadPool = ThreadPoolInfo.readThreadPoolInfo(in); } - if (in.readBoolean()) { - network = NetworkInfo.readNetworkInfo(in); - } if (in.readBoolean()) { transport = TransportInfo.readTransportInfo(in); } @@ -281,12 +265,6 @@ public class NodeInfo extends BaseNodeResponse { out.writeBoolean(true); threadPool.writeTo(out); } - if (network == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - network.writeTo(out); - } if (transport == null) { out.writeBoolean(false); } else { @@ -306,5 +284,4 @@ public class NodeInfo extends BaseNodeResponse { plugins.writeTo(out); } } - } diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java index e872be90142..65033f37b15 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java @@ -111,9 +111,6 @@ public class NodesInfoResponse extends BaseNodesResponse implements To if (nodeInfo.getThreadPool() != null) { nodeInfo.getThreadPool().toXContent(builder, params); } - if (nodeInfo.getNetwork() != null) { - nodeInfo.getNetwork().toXContent(builder, params); - } if (nodeInfo.getTransport() != null) { nodeInfo.getTransport().toXContent(builder, params); } diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java index c7a6f4615a3..5dbc8f76098 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java @@ -31,7 +31,6 @@ import org.elasticsearch.indices.NodeIndicesStats; import org.elasticsearch.indices.breaker.AllCircuitBreakerStats; import org.elasticsearch.monitor.fs.FsStats; import org.elasticsearch.monitor.jvm.JvmStats; -import org.elasticsearch.monitor.network.NetworkStats; import org.elasticsearch.monitor.os.OsStats; import org.elasticsearch.monitor.process.ProcessStats; import org.elasticsearch.threadpool.ThreadPoolStats; @@ -62,9 +61,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent { @Nullable private ThreadPoolStats threadPool; - @Nullable - private NetworkStats network; - @Nullable private FsStats fs; @@ -82,7 +78,7 @@ public class NodeStats extends BaseNodeResponse implements ToXContent { public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices, @Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool, - @Nullable NetworkStats network, @Nullable FsStats fs, @Nullable TransportStats transport, @Nullable HttpStats http, + @Nullable FsStats fs, @Nullable TransportStats transport, @Nullable HttpStats http, @Nullable AllCircuitBreakerStats breaker) { super(node); this.timestamp = timestamp; @@ -91,7 +87,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent { this.process = process; this.jvm = jvm; this.threadPool = threadPool; - this.network = network; this.fs = fs; this.transport = transport; this.http = http; @@ -147,14 +142,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent { return this.threadPool; } - /** - * Network level statistics. - */ - @Nullable - public NetworkStats getNetwork() { - return network; - } - /** * File system level stats. */ @@ -203,9 +190,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent { if (in.readBoolean()) { threadPool = ThreadPoolStats.readThreadPoolStats(in); } - if (in.readBoolean()) { - network = NetworkStats.readNetworkStats(in); - } if (in.readBoolean()) { fs = FsStats.readFsStats(in); } @@ -253,12 +237,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent { out.writeBoolean(true); threadPool.writeTo(out); } - if (network == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - network.writeTo(out); - } if (fs == null) { out.writeBoolean(false); } else { @@ -313,9 +291,6 @@ public class NodeStats extends BaseNodeResponse implements ToXContent { if (getThreadPool() != null) { getThreadPool().toXContent(builder, params); } - if (getNetwork() != null) { - getNetwork().toXContent(builder, params); - } if (getFs() != null) { getFs().toXContent(builder, params); } diff --git a/core/src/main/java/org/elasticsearch/monitor/MonitorModule.java b/core/src/main/java/org/elasticsearch/monitor/MonitorModule.java index a5b9118e9a5..da68b872884 100644 --- a/core/src/main/java/org/elasticsearch/monitor/MonitorModule.java +++ b/core/src/main/java/org/elasticsearch/monitor/MonitorModule.java @@ -26,9 +26,6 @@ import org.elasticsearch.monitor.fs.FsService; import org.elasticsearch.monitor.fs.JmxFsProbe; import org.elasticsearch.monitor.jvm.JvmMonitorService; import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.monitor.network.JmxNetworkProbe; -import org.elasticsearch.monitor.network.NetworkProbe; -import org.elasticsearch.monitor.network.NetworkService; import org.elasticsearch.monitor.os.JmxOsProbe; import org.elasticsearch.monitor.os.OsProbe; import org.elasticsearch.monitor.os.OsService; @@ -56,13 +53,11 @@ public class MonitorModule extends AbstractModule { // bind default implementations bind(ProcessProbe.class).to(JmxProcessProbe.class).asEagerSingleton(); bind(OsProbe.class).to(JmxOsProbe.class).asEagerSingleton(); - bind(NetworkProbe.class).to(JmxNetworkProbe.class).asEagerSingleton(); bind(FsProbe.class).to(JmxFsProbe.class).asEagerSingleton(); // bind other services bind(ProcessService.class).asEagerSingleton(); bind(OsService.class).asEagerSingleton(); - bind(NetworkService.class).asEagerSingleton(); bind(JvmService.class).asEagerSingleton(); bind(FsService.class).asEagerSingleton(); diff --git a/core/src/main/java/org/elasticsearch/monitor/MonitorService.java b/core/src/main/java/org/elasticsearch/monitor/MonitorService.java index 8307e7fd4e5..d7ab517617a 100644 --- a/core/src/main/java/org/elasticsearch/monitor/MonitorService.java +++ b/core/src/main/java/org/elasticsearch/monitor/MonitorService.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.monitor.fs.FsService; import org.elasticsearch.monitor.jvm.JvmMonitorService; import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.monitor.network.NetworkService; import org.elasticsearch.monitor.os.OsService; import org.elasticsearch.monitor.process.ProcessService; @@ -42,20 +41,17 @@ public class MonitorService extends AbstractLifecycleComponent { private final JvmService jvmService; - private final NetworkService networkService; - private final FsService fsService; @Inject public MonitorService(Settings settings, JvmMonitorService jvmMonitorService, - OsService osService, ProcessService processService, JvmService jvmService, NetworkService networkService, + OsService osService, ProcessService processService, JvmService jvmService, FsService fsService) { super(settings); this.jvmMonitorService = jvmMonitorService; this.osService = osService; this.processService = processService; this.jvmService = jvmService; - this.networkService = networkService; this.fsService = fsService; } @@ -71,10 +67,6 @@ public class MonitorService extends AbstractLifecycleComponent { return this.jvmService; } - public NetworkService networkService() { - return this.networkService; - } - public FsService fsService() { return this.fsService; } diff --git a/core/src/main/java/org/elasticsearch/monitor/network/JmxNetworkProbe.java b/core/src/main/java/org/elasticsearch/monitor/network/JmxNetworkProbe.java deleted file mode 100644 index 839bb90e252..00000000000 --- a/core/src/main/java/org/elasticsearch/monitor/network/JmxNetworkProbe.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.monitor.network; - -import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; - -/** - * - */ -public class JmxNetworkProbe extends AbstractComponent implements NetworkProbe { - - @Inject - public JmxNetworkProbe(Settings settings) { - super(settings); - } - - @Override - public NetworkInfo networkInfo() { - NetworkInfo info = new NetworkInfo(); - return info; - } - - @Override - public NetworkStats networkStats() { - NetworkStats stats = new NetworkStats(); - stats.timestamp = System.currentTimeMillis(); - return stats; - } - - @Override - public String ifconfig() { - return "NA"; - } -} diff --git a/core/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java b/core/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java deleted file mode 100644 index 77c9c9460ba..00000000000 --- a/core/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.monitor.network; - -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Streamable; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; - -import java.io.IOException; - -/** - * - */ -public class NetworkInfo implements Streamable, ToXContent { - - public static final Interface NA_INTERFACE = new Interface(); - - long refreshInterval; - - Interface primary = NA_INTERFACE; - - public long refreshInterval() { - return this.refreshInterval; - } - - public long getRefreshInterval() { - return this.refreshInterval; - } - - public Interface primaryInterface() { - return primary; - } - - public Interface getPrimaryInterface() { - return primaryInterface(); - } - - static final class Fields { - static final XContentBuilderString NETWORK = new XContentBuilderString("network"); - static final XContentBuilderString REFRESH_INTERVAL = new XContentBuilderString("refresh_interval"); - static final XContentBuilderString REFRESH_INTERVAL_IN_MILLIS = new XContentBuilderString("refresh_interval_in_millis"); - static final XContentBuilderString PRIMARY_INTERFACE = new XContentBuilderString("primary_interface"); - static final XContentBuilderString ADDRESS = new XContentBuilderString("address"); - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString MAC_ADDRESS = new XContentBuilderString("mac_address"); - } - - @Override - public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { - builder.startObject(Fields.NETWORK); - builder.timeValueField(Fields.REFRESH_INTERVAL_IN_MILLIS, Fields.REFRESH_INTERVAL, refreshInterval); - if (primary != NA_INTERFACE) { - builder.startObject(Fields.PRIMARY_INTERFACE); - builder.field(Fields.ADDRESS, primary.address()); - builder.field(Fields.NAME, primary.name()); - builder.field(Fields.MAC_ADDRESS, primary.macAddress()); - builder.endObject(); - } - builder.endObject(); - return builder; - } - - public static NetworkInfo readNetworkInfo(StreamInput in) throws IOException { - NetworkInfo info = new NetworkInfo(); - info.readFrom(in); - return info; - } - - @Override - public void readFrom(StreamInput in) throws IOException { - refreshInterval = in.readLong(); - primary = Interface.readNetworkInterface(in); - } - - @Override - public void writeTo(StreamOutput out) throws IOException { - out.writeLong(refreshInterval); - primary.writeTo(out); - } - - public static class Interface implements Streamable { - - private String name = ""; - private String address = ""; - private String macAddress = ""; - - private Interface() { - } - - public Interface(String name, String address, String macAddress) { - this.name = name; - this.address = address; - this.macAddress = macAddress; - } - - public String name() { - return name; - } - - public String getName() { - return name(); - } - - public String address() { - return address; - } - - public String getAddress() { - return address(); - } - - public String macAddress() { - return macAddress; - } - - public String getMacAddress() { - return macAddress(); - } - - public static Interface readNetworkInterface(StreamInput in) throws IOException { - Interface inf = new Interface(); - inf.readFrom(in); - return inf; - } - - @Override - public void readFrom(StreamInput in) throws IOException { - name = in.readString(); - address = in.readString(); - macAddress = in.readString(); - } - - @Override - public void writeTo(StreamOutput out) throws IOException { - out.writeString(name); - out.writeString(address); - out.writeString(macAddress); - } - - } -} diff --git a/core/src/main/java/org/elasticsearch/monitor/network/NetworkProbe.java b/core/src/main/java/org/elasticsearch/monitor/network/NetworkProbe.java deleted file mode 100644 index 7ff0293f5e3..00000000000 --- a/core/src/main/java/org/elasticsearch/monitor/network/NetworkProbe.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.monitor.network; - -/** - * - */ -public interface NetworkProbe { - - NetworkInfo networkInfo(); - - NetworkStats networkStats(); - - String ifconfig(); -} diff --git a/core/src/main/java/org/elasticsearch/monitor/network/NetworkService.java b/core/src/main/java/org/elasticsearch/monitor/network/NetworkService.java deleted file mode 100644 index 8e239a30231..00000000000 --- a/core/src/main/java/org/elasticsearch/monitor/network/NetworkService.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.monitor.network; - -import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.SingleObjectCache; - -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.util.Enumeration; - -/** - * - */ -public final class NetworkService extends AbstractComponent { - - private final NetworkProbe probe; - - private final NetworkInfo info; - - private final SingleObjectCache networkStatsCache; - - @Inject - public NetworkService(Settings settings, NetworkProbe probe) { - super(settings); - this.probe = probe; - - TimeValue refreshInterval = settings.getAsTime("monitor.network.refresh_interval", TimeValue.timeValueSeconds(5)); - - logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval); - - this.info = probe.networkInfo(); - this.info.refreshInterval = refreshInterval.millis(); - networkStatsCache = new NetworkStatsCache(refreshInterval, probe.networkStats()); - if (logger.isDebugEnabled()) { - StringBuilder netDebug = new StringBuilder("net_info"); - try { - Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); - String hostName = InetAddress.getLocalHost().getHostName(); - netDebug.append("\nhost [").append(hostName).append("]\n"); - while (interfaces.hasMoreElements()) { - NetworkInterface net = interfaces.nextElement(); - - netDebug.append(net.getName()).append('\t').append("display_name [").append(net.getDisplayName()).append("]\n"); - Enumeration addresses = net.getInetAddresses(); - netDebug.append("\t\taddress "); - while (addresses.hasMoreElements()) { - netDebug.append("[").append(addresses.nextElement()).append("] "); - } - netDebug.append('\n'); - netDebug.append("\t\tmtu [").append(net.getMTU()).append("] multicast [").append(net.supportsMulticast()).append("] ptp [").append(net.isPointToPoint()) - .append("] loopback [").append(net.isLoopback()).append("] up [").append(net.isUp()).append("] virtual [").append(net.isVirtual()).append("]") - .append('\n'); - - Enumeration subInterfaces = net.getSubInterfaces(); - if (subInterfaces != null && subInterfaces.hasMoreElements()) { - netDebug.append("\t\t\tsub interfaces:\n"); - - while (subInterfaces.hasMoreElements()) { - - net = subInterfaces.nextElement(); - - netDebug.append("\t\t\t").append(net.getName()).append("\t").append("display_name [").append(net.getDisplayName()).append("]\n"); - addresses = net.getInetAddresses(); - netDebug.append("\t\t\t\t\taddress "); - while (addresses.hasMoreElements()) { - netDebug.append("[").append(addresses.nextElement()).append("] "); - } - netDebug.append('\n'); - netDebug.append("\t\t\t\t\tmtu [").append(net.getMTU()).append("] multicast [").append(net.supportsMulticast()).append("] ptp [").append(net.isPointToPoint()) - .append("] loopback [").append(net.isLoopback()).append("] up [").append(net.isUp()).append("] virtual [").append(net.isVirtual()).append("]") - .append('\n'); - } - } - } - } catch (Exception ex) { - netDebug.append("failed to get Network Interface Info [" + ex.getMessage() + "]"); - } - logger.debug(netDebug.toString()); - } - - if (logger.isTraceEnabled()) { - logger.trace("ifconfig\n\n" + ifconfig()); - } - stats(); // pull the stats one time - } - - public NetworkInfo info() { - return this.info; - } - - public NetworkStats stats() { - return networkStatsCache.getOrRefresh(); - } - - private class NetworkStatsCache extends SingleObjectCache { - public NetworkStatsCache(TimeValue interval, NetworkStats initValue) { - super(interval, initValue); - } - - @Override - protected NetworkStats refresh() { - return probe.networkStats(); - } - } - - public String ifconfig() { - return probe.ifconfig(); - } -} diff --git a/core/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java b/core/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java deleted file mode 100644 index a5d4671ef81..00000000000 --- a/core/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.monitor.network; - -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Streamable; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; - -import java.io.IOException; - -/** - * - */ -public class NetworkStats implements Streamable, ToXContent { - - long timestamp; - - Tcp tcp = null; - - NetworkStats() { - - } - - static final class Fields { - static final XContentBuilderString NETWORK = new XContentBuilderString("network"); - static final XContentBuilderString TCP = new XContentBuilderString("tcp"); - static final XContentBuilderString ACTIVE_OPENS = new XContentBuilderString("active_opens"); - static final XContentBuilderString PASSIVE_OPENS = new XContentBuilderString("passive_opens"); - static final XContentBuilderString CURR_ESTAB = new XContentBuilderString("curr_estab"); - static final XContentBuilderString IN_SEGS = new XContentBuilderString("in_segs"); - static final XContentBuilderString OUT_SEGS = new XContentBuilderString("out_segs"); - static final XContentBuilderString RETRANS_SEGS = new XContentBuilderString("retrans_segs"); - static final XContentBuilderString ESTAB_RESETS = new XContentBuilderString("estab_resets"); - static final XContentBuilderString ATTEMPT_FAILS = new XContentBuilderString("attempt_fails"); - static final XContentBuilderString IN_ERRS = new XContentBuilderString("in_errs"); - static final XContentBuilderString OUT_RSTS = new XContentBuilderString("out_rsts"); - } - - @Override - public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { - builder.startObject(Fields.NETWORK); - if (tcp != null) { - builder.startObject(Fields.TCP); - builder.field(Fields.ACTIVE_OPENS, tcp.getActiveOpens()); - builder.field(Fields.PASSIVE_OPENS, tcp.getPassiveOpens()); - builder.field(Fields.CURR_ESTAB, tcp.getCurrEstab()); - builder.field(Fields.IN_SEGS, tcp.getInSegs()); - builder.field(Fields.OUT_SEGS, tcp.getOutSegs()); - builder.field(Fields.RETRANS_SEGS, tcp.getRetransSegs()); - builder.field(Fields.ESTAB_RESETS, tcp.getEstabResets()); - builder.field(Fields.ATTEMPT_FAILS, tcp.getAttemptFails()); - builder.field(Fields.IN_ERRS, tcp.getInErrs()); - builder.field(Fields.OUT_RSTS, tcp.getOutRsts()); - builder.endObject(); - } - builder.endObject(); - return builder; - } - - public static NetworkStats readNetworkStats(StreamInput in) throws IOException { - NetworkStats stats = new NetworkStats(); - stats.readFrom(in); - return stats; - } - - @Override - public void readFrom(StreamInput in) throws IOException { - timestamp = in.readVLong(); - if (in.readBoolean()) { - tcp = Tcp.readNetworkTcp(in); - } - } - - @Override - public void writeTo(StreamOutput out) throws IOException { - out.writeVLong(timestamp); - if (tcp == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - tcp.writeTo(out); - } - } - - public long timestamp() { - return timestamp; - } - - public long getTimestamp() { - return timestamp(); - } - - public Tcp tcp() { - return tcp; - } - - public Tcp getTcp() { - return tcp(); - } - - public static class Tcp implements Streamable { - - long activeOpens; - long passiveOpens; - long attemptFails; - long estabResets; - long currEstab; - long inSegs; - long outSegs; - long retransSegs; - long inErrs; - long outRsts; - - public static Tcp readNetworkTcp(StreamInput in) throws IOException { - Tcp tcp = new Tcp(); - tcp.readFrom(in); - return tcp; - } - - @Override - public void readFrom(StreamInput in) throws IOException { - activeOpens = in.readLong(); - passiveOpens = in.readLong(); - attemptFails = in.readLong(); - estabResets = in.readLong(); - currEstab = in.readLong(); - inSegs = in.readLong(); - outSegs = in.readLong(); - retransSegs = in.readLong(); - inErrs = in.readLong(); - outRsts = in.readLong(); - } - - @Override - public void writeTo(StreamOutput out) throws IOException { - out.writeLong(activeOpens); - out.writeLong(passiveOpens); - out.writeLong(attemptFails); - out.writeLong(estabResets); - out.writeLong(currEstab); - out.writeLong(inSegs); - out.writeLong(outSegs); - out.writeLong(retransSegs); - out.writeLong(inErrs); - out.writeLong(outRsts); - } - - public long activeOpens() { - return this.activeOpens; - } - - public long getActiveOpens() { - return activeOpens(); - } - - public long passiveOpens() { - return passiveOpens; - } - - public long getPassiveOpens() { - return passiveOpens(); - } - - public long attemptFails() { - return attemptFails; - } - - public long getAttemptFails() { - return attemptFails(); - } - - public long estabResets() { - return estabResets; - } - - public long getEstabResets() { - return estabResets(); - } - - public long currEstab() { - return currEstab; - } - - public long getCurrEstab() { - return currEstab(); - } - - public long inSegs() { - return inSegs; - } - - public long getInSegs() { - return inSegs(); - } - - public long outSegs() { - return outSegs; - } - - public long getOutSegs() { - return outSegs(); - } - - public long retransSegs() { - return retransSegs; - } - - public long getRetransSegs() { - return retransSegs(); - } - - public long inErrs() { - return inErrs; - } - - public long getInErrs() { - return inErrs(); - } - - public long outRsts() { - return outRsts; - } - - public long getOutRsts() { - return outRsts(); - } - } -} diff --git a/core/src/main/java/org/elasticsearch/node/service/NodeService.java b/core/src/main/java/org/elasticsearch/node/service/NodeService.java index 81dd3c109e7..e50fd3e7ee2 100644 --- a/core/src/main/java/org/elasticsearch/node/service/NodeService.java +++ b/core/src/main/java/org/elasticsearch/node/service/NodeService.java @@ -102,7 +102,6 @@ public class NodeService extends AbstractComponent { monitorService.processService().info(), monitorService.jvmService().info(), threadPool.info(), - monitorService.networkService().info(), transportService.info(), httpServer == null ? null : httpServer.info(), pluginService == null ? null : pluginService.info() @@ -117,7 +116,6 @@ public class NodeService extends AbstractComponent { process ? monitorService.processService().info() : null, jvm ? monitorService.jvmService().info() : null, threadPool ? this.threadPool.info() : null, - network ? monitorService.networkService().info() : null, transport ? transportService.info() : null, http ? (httpServer == null ? null : httpServer.info()) : null, plugin ? (pluginService == null ? null : pluginService.info()) : null @@ -133,7 +131,6 @@ public class NodeService extends AbstractComponent { monitorService.processService().stats(), monitorService.jvmService().stats(), threadPool.stats(), - monitorService.networkService().stats(), monitorService.fsService().stats(), transportService.stats(), httpServer == null ? null : httpServer.stats(), @@ -151,7 +148,6 @@ public class NodeService extends AbstractComponent { process ? monitorService.processService().stats() : null, jvm ? monitorService.jvmService().stats() : null, threadPool ? this.threadPool.stats() : null, - network ? monitorService.networkService().stats() : null, fs ? monitorService.fsService().stats() : null, transport ? transportService.stats() : null, http ? (httpServer == null ? null : httpServer.stats()) : null, diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesTests.java index db4bb576552..48a2a609b19 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesTests.java @@ -148,7 +148,7 @@ public class MockDiskUsagesTests extends ElasticsearchIntegrationTest { FsStats fsStats = new FsStats(System.currentTimeMillis(), infos); return new NodeStats(new DiscoveryNode(nodeName, null, Version.V_2_0_0), System.currentTimeMillis(), - null, null, null, null, null, null, + null, null, null, null, null, fsStats, null, null, null); } diff --git a/core/src/test/java/org/elasticsearch/stresstest/leaks/GenericStatsLeak.java b/core/src/test/java/org/elasticsearch/stresstest/leaks/GenericStatsLeak.java index 3ea972dce4e..03d0ca76d04 100644 --- a/core/src/test/java/org/elasticsearch/stresstest/leaks/GenericStatsLeak.java +++ b/core/src/test/java/org/elasticsearch/stresstest/leaks/GenericStatsLeak.java @@ -21,7 +21,6 @@ package org.elasticsearch.stresstest.leaks; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.monitor.network.NetworkService; import org.elasticsearch.monitor.os.OsService; import org.elasticsearch.monitor.process.ProcessService; import org.elasticsearch.node.Node; @@ -39,13 +38,11 @@ public class GenericStatsLeak { JvmService jvmService = node.injector().getInstance(JvmService.class); OsService osService = node.injector().getInstance(OsService.class); ProcessService processService = node.injector().getInstance(ProcessService.class); - NetworkService networkService = node.injector().getInstance(NetworkService.class); while (true) { jvmService.stats(); osService.stats(); processService.stats(); - networkService.stats(); } } } \ No newline at end of file diff --git a/docs/reference/cluster/nodes-info.asciidoc b/docs/reference/cluster/nodes-info.asciidoc index 61d8c1a5a6a..07a2360acbe 100644 --- a/docs/reference/cluster/nodes-info.asciidoc +++ b/docs/reference/cluster/nodes-info.asciidoc @@ -17,7 +17,7 @@ The second command selectively retrieves nodes information of only By default, it just returns all attributes and core settings for a node. It also allows to get only information on `settings`, `os`, `process`, `jvm`, -`thread_pool`, `network`, `transport`, `http` and `plugins`: +`thread_pool`, `transport`, `http` and `plugins`: [source,js] -------------------------------------------------- diff --git a/docs/reference/cluster/nodes-stats.asciidoc b/docs/reference/cluster/nodes-stats.asciidoc index 81d027f8779..3ccc7204bb0 100644 --- a/docs/reference/cluster/nodes-stats.asciidoc +++ b/docs/reference/cluster/nodes-stats.asciidoc @@ -19,7 +19,7 @@ second command selectively retrieves nodes stats of only `nodeId1` and <>. By default, all stats are returned. You can limit this by combining any -of `indices`, `os`, `process`, `jvm`, `network`, `transport`, `http`, +of `indices`, `os`, `process`, `jvm`, `transport`, `http`, `fs`, `breaker` and `thread_pool`. For example: [horizontal] @@ -38,9 +38,6 @@ of `indices`, `os`, `process`, `jvm`, `network`, `transport`, `http`, JVM stats, memory pool information, garbage collection, buffer pools -`network`:: - TCP information - `os`:: Operating system stats, load average, cpu, mem, swap diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/nodes.info.json b/rest-api-spec/src/main/resources/rest-api-spec/api/nodes.info.json index faebeec174e..d8044c8a5f6 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/nodes.info.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/nodes.info.json @@ -12,7 +12,7 @@ }, "metric": { "type": "list", - "options": ["settings", "os", "process", "jvm", "thread_pool", "network", "transport", "http", "plugins"], + "options": ["settings", "os", "process", "jvm", "thread_pool", "transport", "http", "plugins"], "description": "A comma-separated list of metrics you wish returned. Leave empty to return all." } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/nodes.stats.json b/rest-api-spec/src/main/resources/rest-api-spec/api/nodes.stats.json index 59b69c85e4c..5eef2c18d32 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/nodes.stats.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/nodes.stats.json @@ -15,7 +15,7 @@ "parts": { "metric" : { "type" : "list", - "options" : ["_all", "breaker", "fs", "http", "indices", "jvm", "network", "os", "process", "thread_pool", "transport"], + "options" : ["_all", "breaker", "fs", "http", "indices", "jvm", "os", "process", "thread_pool", "transport"], "description" : "Limit the information returned to the specified metrics" }, "index_metric" : {