changeset 434:dbbac526c4a0

Reporter - MetricsCollection - httpClient
author Devel 1
date Thu, 27 Jul 2017 14:59:15 +0200
parents f2d245d74663
children 657042d50537
files stress-tester-reporter/src/main/java/com/passus/st/reporter/MetricConverter.java
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester-reporter/src/main/java/com/passus/st/reporter/MetricConverter.java	Thu Jul 27 13:37:40 2017 +0200
+++ b/stress-tester-reporter/src/main/java/com/passus/st/reporter/MetricConverter.java	Thu Jul 27 14:59:15 2017 +0200
@@ -38,9 +38,9 @@
         return conv == null ? o.toString() : conv.convert(o);
     }
 
-    private HashMap processEntries(HashMap<Object, Object> map) {
+    private Map<Object, Object> processEntries(Map<Object, Object> map) {
         try {
-            HashMap proc = map.getClass().newInstance();
+            Map proc = map.getClass().newInstance();
             for (Map.Entry<Object, Object> e : map.entrySet()) {
                 Object key = convertIfNeeded(e.getKey());
                 Object value = convertIfNeeded(e.getValue());
@@ -56,15 +56,15 @@
         Map<CharSequence, Object> fields = new HashMap<>();
         Set<String> names = metric.getAttributesName();
         for (String name : names) {
-            Serializable value = metric.getAttributeValue(name);
+            Object value = metric.getAttributeValue(name);
             if (value != null) {
                 Converter converter = converters.get(value.getClass());
                 if (converter != null) {
                     value = converter.convert(value);
                 } else if (procEmbeddedMetric && value instanceof Metric) {
-                    value = convert(metric, false);
-                } else if (procEmbeddedMetric && value instanceof HashMap) {
-                    value = processEntries((HashMap) value);
+                    value = convert((Metric) value, false);
+                } else if (procEmbeddedMetric && value instanceof Map) {
+                    value = processEntries((Map) value);
                 }
                 fields.put(name, value);
             }
@@ -73,7 +73,7 @@
         return new MetricRecord(metric.getName(), fields);
     }
 
-    private final Set<String> allowed = new HashSet<>(Arrays.asList("emitter", "pcapSource"));
+    private final Set<String> allowed = new HashSet<>(Arrays.asList("emitter", "pcapSource", "httpClient"));
 
     public MetricsCollectionRecord convert(MetricsCollection collection) {
         List<Metric> metrics = collection.getMetrics();