changeset 562:dcd36403d61d

Metrics minor changes
author Devel 2
date Thu, 21 Sep 2017 15:21:35 +0200
parents d836ea2aefed
children 0f92cca7980c
files stress-tester/src/main/java/com/passus/st/emitter/EmitterMetric.java stress-tester/src/main/java/com/passus/st/metric/SummrizeMetricsCollectionHandler.java
diffstat 2 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/emitter/EmitterMetric.java	Thu Sep 21 15:18:34 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/emitter/EmitterMetric.java	Thu Sep 21 15:21:35 2017 +0200
@@ -19,7 +19,7 @@
  */
 public class EmitterMetric implements Metric {
 
-    private static final String DEFAULT_NAME = "emitter";
+    public static final String DEFAULT_NAME = "emitter";
 
     private final Map<String, Serializable> attrs = new LinkedHashMap<>();
 
@@ -71,18 +71,34 @@
         sentBytes.add(value);
     }
 
+    public long sentBytes() {
+        return sentBytes.longValue();
+    }
+
     public void updateReceivedBytes(long value) {
         receivedBytes.add(value);
     }
 
+    public long receivedBytes() {
+        return receivedBytes.longValue();
+    }
+
     public void incConnectionsErrors() {
         connectionsErrors.increment();
     }
 
+    public int connectionsErrors() {
+        return connectionsErrors.intValue();
+    }
+
     public void incClosedConnections() {
         closedConnections.increment();
     }
 
+    public int closedConnections() {
+        return connectionsErrors.intValue();
+    }
+
     public void incBindErrors() {
         bindErrors.increment();
     }
@@ -97,6 +113,10 @@
         }
     }
 
+    public int establishedConnections() {
+        return establishedConnections.intValue();
+    }
+
     public void addBindSocket(SocketAddress address) {
         //bindedSockets.add(address);
     }
--- a/stress-tester/src/main/java/com/passus/st/metric/SummrizeMetricsCollectionHandler.java	Thu Sep 21 15:18:34 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/metric/SummrizeMetricsCollectionHandler.java	Thu Sep 21 15:21:35 2017 +0200
@@ -19,6 +19,10 @@
         return new ArrayList<>(metrics.values());
     }
 
+    public Metric getMetric(String name) {
+        return metrics.get(name);
+    }
+
     @Override
     public void handle(MetricsCollection mc) {
         for (Metric metric : mc.getMetrics()) {