You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2021/11/19 19:44:25 UTC

[geode] 05/16: adds tcp/udp stats adds file handle stats.

This is an automated email from the ASF dual-hosted git repository.

jbarrett pushed a commit to branch wip/oshi-multios-stats-module
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 599dbb54f918a54c3aa7a5f6c18810eb1e45eb97
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Sat Jun 12 20:12:46 2021 -0700

    adds tcp/udp stats
    adds file handle stats.
---
 .../statistics/oshi/OperatingSystemStats.java      | 150 +++++++++++++++++++++
 .../oshi/OshiStatisticsProviderImpl.java           |  46 +++++++
 2 files changed, 196 insertions(+)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/oshi/OperatingSystemStats.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/oshi/OperatingSystemStats.java
index 49f819d..1d4bba0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/oshi/OperatingSystemStats.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/oshi/OperatingSystemStats.java
@@ -52,6 +52,36 @@ public class OperatingSystemStats {
   static final int virtualInUse;
   static final int swapPagesIn;
   static final int swapPagesOut;
+  static final int tcpv4ConnectionsEstablished;
+  static final int tcpv4ConnectionsActive;
+  static final int tcpv4ConnectionsPassive;
+  static final int tcpv4ConnectionFailures;
+  static final int tcpv4ConnectionsReset;
+  static final int tcpv4SegmentsSent;
+  static final int tcpv4SegmentsReceived;
+  static final int tcpv4SegmentsRetransmitted;
+  static final int tcpv4InErrors;
+  static final int tcpv4OutResets;
+  static final int udpv4DatagramsSent;
+  static final int udpv4DatagramsReceived;
+  static final int udpv4DatagramsNoPort;
+  static final int udpv4DatagramsReceivedErrors;
+  static final int tcpv6ConnectionsEstablished;
+  static final int tcpv6ConnectionsActive;
+  static final int tcpv6ConnectionsPassive;
+  static final int tcpv6ConnectionFailures;
+  static final int tcpv6ConnectionsReset;
+  static final int tcpv6SegmentsSent;
+  static final int tcpv6SegmentsReceived;
+  static final int tcpv6SegmentsRetransmitted;
+  static final int tcpv6InErrors;
+  static final int tcpv6OutResets;
+  static final int udpv6DatagramsSent;
+  static final int udpv6DatagramsReceived;
+  static final int udpv6DatagramsNoPort;
+  static final int udpv6DatagramsReceivedErrors;
+  static final int openFileDescriptors;
+  static final int maxFileDescriptors;
 
   @Immutable
   private static final StatisticsType statisticsType;
@@ -144,6 +174,96 @@ public class OperatingSystemStats {
             f.createLongCounter("swapPagesOut",
                 "Number of pages read from paging/swap file(s) to resolve hard page faults.",
                 "pages"),
+            f.createLongGauge("tcpv4ConnectionsEstablished",
+                "Connection Failures is the number of times TCP connections have made a direct transition to the CLOSED state from the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition to the LISTEN state from the SYN-RCVD state.",
+                "connections"),
+            f.createLongCounter("tcpv4ConnectionsActive",
+                "Connections Active is the number of times TCP connections have made a direct transition to the SYN-SENT state from the CLOSED state. In other words, it shows a number of connections which are initiated by the local computer. The value is a cumulative total.",
+                "connections"),
+            f.createLongCounter("tcpv4ConnectionsPassive",
+                "Connections Passive is the number of times TCP connections have made a direct transition to the SYN-RCVD state from the LISTEN state. In other words, it shows a number of connections to the local computer, which are initiated by remote computers. The value is a cumulative total.",
+                "connections"),
+            f.createLongCounter("tcpv4ConnectionFailures",
+                "Connections Established is the number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT.",
+                "connections"),
+            f.createLongCounter("tcpv4ConnectionsReset",
+                "Connections Reset is the number of times TCP connections have made a direct transition to the CLOSED state from either the ESTABLISHED state or the CLOSE-WAIT state.",
+                "connections"),
+            f.createLongCounter("tcpv4SegmentsSent",
+                "Segments Sent is the number of segments sent, including those on current connections, but excluding those containing only retransmitted bytes.",
+                "segments"),
+            f.createLongCounter("tcpv4SegmentsReceived",
+                "Segments Received is the number of segments received, including those received in error. This count includes segments received on currently established connections.",
+                "segments"),
+            f.createLongCounter("tcpv4SegmentsRetransmitted",
+                "Segments Retransmitted is the number of segments retransmitted, that is, segments transmitted containing one or more previously transmitted bytes.",
+                "segments"),
+            f.createLongCounter("tcpv4InErrors",
+                "The number of errors received.",
+                "errors"),
+            f.createLongCounter("tcpv4OutResets",
+                "The number of segments transmitted with the reset flag set.",
+                "segments"),
+            f.createLongCounter("udpv4DatagramsSent",
+                "Datagrams Sent is the number of UDP datagrams sent from the entity.",
+                "datagrams"),
+            f.createLongCounter("udpv4DatagramsReceived",
+                "Datagrams Received is the number of UDP datagrams delivered to UDP users",
+                "datagrams"),
+            f.createLongCounter("udpv4DatagramsNoPort",
+                "Datagrams No Port is the number of received UDP datagrams for which there was no application at the destination port.",
+                "datagrams"),
+            f.createLongCounter("udpv4DatagramsReceivedErrors",
+                "Datagrams Received Errors is the number of received UDP datagrams that could not be delivered for reasons other than the lack of an application at the destination port.",
+                "datagrams"),
+            f.createLongGauge("tcpv6ConnectionsEstablished",
+                "Connection Failures is the number of times TCP connections have made a direct transition to the CLOSED state from the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition to the LISTEN state from the SYN-RCVD state.",
+                "connections"),
+            f.createLongCounter("tcpv6ConnectionsActive",
+                "Connections Active is the number of times TCP connections have made a direct transition to the SYN-SENT state from the CLOSED state. In other words, it shows a number of connections which are initiated by the local computer. The value is a cumulative total.",
+                "connections"),
+            f.createLongCounter("tcpv6ConnectionsPassive",
+                "Connections Passive is the number of times TCP connections have made a direct transition to the SYN-RCVD state from the LISTEN state. In other words, it shows a number of connections to the local computer, which are initiated by remote computers. The value is a cumulative total.",
+                "connections"),
+            f.createLongCounter("tcpv6ConnectionFailures",
+                "Connections Established is the number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT.",
+                "connections"),
+            f.createLongCounter("tcpv6ConnectionsReset",
+                "Connections Reset is the number of times TCP connections have made a direct transition to the CLOSED state from either the ESTABLISHED state or the CLOSE-WAIT state.",
+                "connections"),
+            f.createLongCounter("tcpv6SegmentsSent",
+                "Segments Sent is the number of segments sent, including those on current connections, but excluding those containing only retransmitted bytes.",
+                "segments"),
+            f.createLongCounter("tcpv6SegmentsReceived",
+                "Segments Received is the number of segments received, including those received in error. This count includes segments received on currently established connections.",
+                "segments"),
+            f.createLongCounter("tcpv6SegmentsRetransmitted",
+                "Segments Retransmitted is the number of segments retransmitted, that is, segments transmitted containing one or more previously transmitted bytes.",
+                "segments"),
+            f.createLongCounter("tcpv6InErrors",
+                "The number of errors received.",
+                "errors"),
+            f.createLongCounter("tcpv6OutResets",
+                "The number of segments transmitted with the reset flag set.",
+                "segments"),
+            f.createLongCounter("udpv6DatagramsSent",
+                "Datagrams Sent is the number of UDP datagrams sent from the entity.",
+                "datagrams"),
+            f.createLongCounter("udpv6DatagramsReceived",
+                "Datagrams Received is the number of UDP datagrams delivered to UDP users",
+                "datagrams"),
+            f.createLongCounter("udpv6DatagramsNoPort",
+                "Datagrams No Port is the number of received UDP datagrams for which there was no application at the destination port.",
+                "datagrams"),
+            f.createLongCounter("udpv6DatagramsReceivedErrors",
+                "Datagrams Received Errors is the number of received UDP datagrams that could not be delivered for reasons other than the lack of an application at the destination port.",
+                "datagrams"),
+            f.createLongGauge("openFileDescriptors",
+                "The current number of open file descriptors",
+                "files"),
+            f.createLongGauge("maxFileDescriptors",
+                "The maximum number of open file descriptors.",
+                "files"),
     });
 
     processCount = statisticsType.nameToId("processCount");
@@ -174,6 +294,36 @@ public class OperatingSystemStats {
     virtualInUse = statisticsType.nameToId("virtualInUse");
     swapPagesIn = statisticsType.nameToId("swapPagesIn");
     swapPagesOut = statisticsType.nameToId("swapPagesOut");
+    tcpv4ConnectionsEstablished = statisticsType.nameToId("tcpv4ConnectionsEstablished");
+    tcpv4ConnectionsActive = statisticsType.nameToId("tcpv4ConnectionsActive");
+    tcpv4ConnectionsPassive = statisticsType.nameToId("tcpv4ConnectionsPassive");
+    tcpv4ConnectionFailures = statisticsType.nameToId("tcpv4ConnectionFailures");
+    tcpv4ConnectionsReset = statisticsType.nameToId("tcpv4ConnectionsReset");
+    tcpv4SegmentsSent = statisticsType.nameToId("tcpv4SegmentsSent");
+    tcpv4SegmentsReceived = statisticsType.nameToId("tcpv4SegmentsReceived");
+    tcpv4SegmentsRetransmitted = statisticsType.nameToId("tcpv4SegmentsRetransmitted");
+    tcpv4InErrors = statisticsType.nameToId("tcpv4InErrors");
+    tcpv4OutResets = statisticsType.nameToId("tcpv4OutResets");
+    udpv4DatagramsSent = statisticsType.nameToId("udpv4DatagramsSent");
+    udpv4DatagramsReceived = statisticsType.nameToId("udpv4DatagramsReceived");
+    udpv4DatagramsNoPort = statisticsType.nameToId("udpv4DatagramsNoPort");
+    udpv4DatagramsReceivedErrors = statisticsType.nameToId("udpv4DatagramsReceivedErrors");
+    tcpv6ConnectionsEstablished = statisticsType.nameToId("tcpv6ConnectionsEstablished");
+    tcpv6ConnectionsActive = statisticsType.nameToId("tcpv6ConnectionsActive");
+    tcpv6ConnectionsPassive = statisticsType.nameToId("tcpv6ConnectionsPassive");
+    tcpv6ConnectionFailures = statisticsType.nameToId("tcpv6ConnectionFailures");
+    tcpv6ConnectionsReset = statisticsType.nameToId("tcpv6ConnectionsReset");
+    tcpv6SegmentsSent = statisticsType.nameToId("tcpv6SegmentsSent");
+    tcpv6SegmentsReceived = statisticsType.nameToId("tcpv6SegmentsReceived");
+    tcpv6SegmentsRetransmitted = statisticsType.nameToId("tcpv6SegmentsRetransmitted");
+    tcpv6InErrors = statisticsType.nameToId("tcpv6InErrors");
+    tcpv6OutResets = statisticsType.nameToId("tcpv6OutResets");
+    udpv6DatagramsSent = statisticsType.nameToId("udpv6DatagramsSent");
+    udpv6DatagramsReceived = statisticsType.nameToId("udpv6DatagramsReceived");
+    udpv6DatagramsNoPort = statisticsType.nameToId("udpv6DatagramsNoPort");
+    udpv6DatagramsReceivedErrors = statisticsType.nameToId("udpv6DatagramsReceivedErrors");
+    openFileDescriptors = statisticsType.nameToId("openFileDescriptors");
+    maxFileDescriptors = statisticsType.nameToId("maxFileDescriptors");
 
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/oshi/OshiStatisticsProviderImpl.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/oshi/OshiStatisticsProviderImpl.java
index ce02b38..44fc546 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/oshi/OshiStatisticsProviderImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/oshi/OshiStatisticsProviderImpl.java
@@ -12,6 +12,10 @@ import oshi.hardware.GlobalMemory;
 import oshi.hardware.HardwareAbstractionLayer;
 import oshi.hardware.NetworkIF;
 import oshi.hardware.VirtualMemory;
+import oshi.software.os.FileSystem;
+import oshi.software.os.InternetProtocolStats;
+import oshi.software.os.InternetProtocolStats.TcpStats;
+import oshi.software.os.InternetProtocolStats.UdpStats;
 import oshi.software.os.OSProcess;
 import oshi.software.os.OperatingSystem;
 
@@ -161,6 +165,48 @@ public class OshiStatisticsProviderImpl implements OshiStatisticsProvider {
     systemStats.setLong(OperatingSystemStats.virtualInUse, virtualMemory.getVirtualInUse());
     systemStats.setLong(OperatingSystemStats.swapPagesIn, virtualMemory.getSwapPagesIn());
     systemStats.setLong(OperatingSystemStats.swapPagesOut, virtualMemory.getSwapPagesOut());
+
+    final InternetProtocolStats internetProtocolStats = operatingSystem.getInternetProtocolStats();
+    final TcpStats tcPv4Stats = internetProtocolStats.getTCPv4Stats();
+    systemStats.setLong(OperatingSystemStats.tcpv4ConnectionsEstablished, tcPv4Stats.getConnectionsEstablished());
+    systemStats.setLong(OperatingSystemStats.tcpv4ConnectionsActive, tcPv4Stats.getConnectionsActive());
+    systemStats.setLong(OperatingSystemStats.tcpv4ConnectionsPassive, tcPv4Stats.getConnectionsPassive());
+    systemStats.setLong(OperatingSystemStats.tcpv4ConnectionFailures, tcPv4Stats.getConnectionFailures());
+    systemStats.setLong(OperatingSystemStats.tcpv4ConnectionsReset, tcPv4Stats.getConnectionsReset());
+    systemStats.setLong(OperatingSystemStats.tcpv4SegmentsSent, tcPv4Stats.getSegmentsSent());
+    systemStats.setLong(OperatingSystemStats.tcpv4SegmentsReceived, tcPv4Stats.getSegmentsReceived());
+    systemStats.setLong(OperatingSystemStats.tcpv4SegmentsRetransmitted, tcPv4Stats.getSegmentsRetransmitted());
+    systemStats.setLong(OperatingSystemStats.tcpv4InErrors, tcPv4Stats.getInErrors());
+    systemStats.setLong(OperatingSystemStats.tcpv4OutResets, tcPv4Stats.getOutResets());
+
+    final UdpStats udPv4Stats = internetProtocolStats.getUDPv4Stats();
+    systemStats.setLong(OperatingSystemStats.udpv4DatagramsSent, udPv4Stats.getDatagramsSent());
+    systemStats.setLong(OperatingSystemStats.udpv4DatagramsReceived, udPv4Stats.getDatagramsReceived());
+    systemStats.setLong(OperatingSystemStats.udpv4DatagramsNoPort, udPv4Stats.getDatagramsNoPort());
+    systemStats.setLong(OperatingSystemStats.udpv4DatagramsReceivedErrors, udPv4Stats.getDatagramsReceivedErrors());
+
+    final TcpStats tcPv6Stats = internetProtocolStats.getTCPv6Stats();
+    systemStats.setLong(OperatingSystemStats.tcpv6ConnectionsEstablished, tcPv6Stats.getConnectionsEstablished());
+    systemStats.setLong(OperatingSystemStats.tcpv6ConnectionsActive, tcPv6Stats.getConnectionsActive());
+    systemStats.setLong(OperatingSystemStats.tcpv6ConnectionsPassive, tcPv6Stats.getConnectionsPassive());
+    systemStats.setLong(OperatingSystemStats.tcpv6ConnectionFailures, tcPv6Stats.getConnectionFailures());
+    systemStats.setLong(OperatingSystemStats.tcpv6ConnectionsReset, tcPv6Stats.getConnectionsReset());
+    systemStats.setLong(OperatingSystemStats.tcpv6SegmentsSent, tcPv6Stats.getSegmentsSent());
+    systemStats.setLong(OperatingSystemStats.tcpv6SegmentsReceived, tcPv6Stats.getSegmentsReceived());
+    systemStats.setLong(OperatingSystemStats.tcpv6SegmentsRetransmitted, tcPv6Stats.getSegmentsRetransmitted());
+    systemStats.setLong(OperatingSystemStats.tcpv6InErrors, tcPv6Stats.getInErrors());
+    systemStats.setLong(OperatingSystemStats.tcpv6OutResets, tcPv6Stats.getOutResets());
+
+    final UdpStats udPv6Stats = internetProtocolStats.getUDPv6Stats();
+    systemStats.setLong(OperatingSystemStats.udpv6DatagramsSent, udPv6Stats.getDatagramsSent());
+    systemStats.setLong(OperatingSystemStats.udpv6DatagramsReceived, udPv6Stats.getDatagramsReceived());
+    systemStats.setLong(OperatingSystemStats.udpv6DatagramsNoPort, udPv6Stats.getDatagramsNoPort());
+    systemStats.setLong(OperatingSystemStats.udpv6DatagramsReceivedErrors, udPv6Stats.getDatagramsReceivedErrors());
+
+    final FileSystem fileSystem = operatingSystem.getFileSystem();
+    systemStats.setLong(OperatingSystemStats.openFileDescriptors, fileSystem.getOpenFileDescriptors());
+    systemStats.setLong(OperatingSystemStats.openFileDescriptors, fileSystem.getMaxFileDescriptors());
+
   }
 
   private void sampleProcessors() {