changeset 548:e3aa81458572

stress-tester-reporter - req and resp in single message
author Devel 1
date Fri, 15 Sep 2017 09:59:06 +0200
parents 0de0512fc8e0
children 4bdd968d121b
files stress-tester-reporter/src/main/java/com/passus/st/reporter/server/ReporterImpl.java stress-tester/src/main/java/com/passus/st/client/http/HttpMessageMetric.java stress-tester/src/main/java/com/passus/st/client/http/HttpReporterClientListener.java stress-tester/src/main/java/com/passus/st/client/http/HttpRequestMetric.java stress-tester/src/main/java/com/passus/st/client/http/HttpRequestResponseMetric.java stress-tester/src/main/java/com/passus/st/client/http/HttpResponseMetric.java
diffstat 6 files changed, 559 insertions(+), 563 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester-reporter/src/main/java/com/passus/st/reporter/server/ReporterImpl.java	Fri Sep 15 09:04:34 2017 +0200
+++ b/stress-tester-reporter/src/main/java/com/passus/st/reporter/server/ReporterImpl.java	Fri Sep 15 09:59:06 2017 +0200
@@ -60,66 +60,67 @@
             System.out.println(metric);
         }
 
-        Map<CharSequence, Object> fields = metric.getFields();
         String code = metric.getCode().toString();
-        StringBuilder builder = new StringBuilder();
 
-        if (code.equalsIgnoreCase("httpRequest")) {
+        if (code.equalsIgnoreCase("httpRequestResponse")) {
+            Map<CharSequence, Object> fields = metric.getFields();
+            StringBuilder builder = new StringBuilder();
+
             addValue(builder, getValue(fields, "reqId"));
-            addValue(builder, getValue(fields, "reqMethod"));
-            addValue(builder, getValue(fields, "version"));
+            addValue(builder, getValue(fields, "method"));
+            addValue(builder, getValue(fields, "reqVersion"));
             addValue(builder, getValue(fields, "url"));
-            addValue(builder, getValue(fields, "timeStart"));
-            addValue(builder, getValue(fields, "timeStop"));
+            addValue(builder, getValue(fields, "reqStart"));
+            addValue(builder, getValue(fields, "reqStop"));
             addValue(builder, getValue(fields, "serverIp"));
             addValue(builder, getValue(fields, "serverPort"));
             addValue(builder, getValue(fields, "clientIp"));
             addValue(builder, getValue(fields, "clientPort"));
-            addValue(builder, getValue(fields, "messageHeaderSize"));
-            addValue(builder, getValue(fields, "messageContentSize"));
-            Map<CharSequence, CharSequence> heads = (Map<CharSequence, CharSequence>) fields.get(new Utf8("headers"));
-            addValue(builder, getValue(heads, "User-Agent"));
+            addValue(builder, getValue(fields, "reqHdrSize"));
+            addValue(builder, getValue(fields, "reqCntSize"));
+            Map<CharSequence, CharSequence> reqHdrs = (Map<CharSequence, CharSequence>) fields.get(new Utf8("reqHdrs"));
+            addValue(builder, getValue(reqHdrs, "User-Agent"));
             Map<CharSequence, CharSequence> misc = (Map<CharSequence, CharSequence>) fields.get(new Utf8("misc"));
             addValue(builder, getValue(misc, "sessionId"));
             addValue(builder, getValue(misc, "username"));
             reqFile.println(builder.toString());
             reqFile.flush();
-        }
+            builder.setLength(0);
 
-        if (code.equalsIgnoreCase("httpResponse")) {
             addValue(builder, getValue(fields, "reqId"));
             addValue(builder, getValue(fields, "reason"));
-            addValue(builder, getValue(fields, "statusCode"));
-            addValue(builder, getValue(fields, "timeStart"));
-            addValue(builder, getValue(fields, "timeStop"));
-            Map<CharSequence, CharSequence> heads = (Map<CharSequence, CharSequence>) fields.get(new Utf8("headers"));
-            addValue(builder, getValue(heads, "Content-Type"));
-//            addValue(builder, fields.get(new Utf8("clientIp")));
-//            addValue(builder, fields.get(new Utf8("clientPort")));
-//            addValue(builder, fields.get(new Utf8("serverIp")));
-//            addValue(builder, fields.get(new Utf8("serverPort")));
-            addValue(builder, getValue(fields, "messageHeaderSize"));
-            addValue(builder, getValue(fields, "messageContentSize"));
+            addValue(builder, getValue(fields, "code"));
+            addValue(builder, getValue(fields, "respStart"));
+            addValue(builder, getValue(fields, "respStop"));
+            Map<CharSequence, CharSequence> respHdrs = (Map<CharSequence, CharSequence>) fields.get(new Utf8("respHdrs"));
+            addValue(builder, getValue(respHdrs, "Content-Type"));
+            addValue(builder, getValue(fields, "respHdrSize"));
+            addValue(builder, getValue(fields, "respCntSize"));
             respFile.println(builder.toString());
             respFile.flush();
-        }
+            builder.setLength(0);
 
-        long timeStart = Long.parseLong(getValue(fields, "timeStart"));
-        long timeStop = Long.parseLong(getValue(fields, "timeStop"));
-        long timeDiff = timeStop - timeStart;
-        if (timeDiff > 1000) {
-            System.out.println("DIFF: " + code + " " + timeDiff + " " + builder.toString());
+            // unused keys:
+            // origClientIp origClientPort origServerIp origServerPort
+            // respVersion
+            long reqStart = Long.parseLong(getValue(fields, "reqStart"));
+            long reqStop = Long.parseLong(getValue(fields, "reqStop"));
+            long respStart = Long.parseLong(getValue(fields, "respStart"));
+            long respStop = Long.parseLong(getValue(fields, "respStop"));
+            String url = getValue(fields, "url");
+            printDuration(reqStart, reqStop, "req", url);
+            printDuration(reqStop, respStart, "r2r", url);
+            printDuration(respStart, respStop, "res", url);
         }
 
-        if (verbose) {
-            System.out.println(fields.getClass());
-            for (Map.Entry<CharSequence, Object> e : fields.entrySet()) {
-                CharSequence k = e.getKey();
-                Object v = e.getValue();
-                System.out.println("entry " + k.getClass() + " " + k + " => " + v.getClass() + " " + v);
-            }
+        return "OK";
+    }
+
+    private static void printDuration(long start, long end, String name, String url) {
+        long diff = end - start;
+        if (diff > 1000) {
+            System.out.println("long " + name + ": " + diff + " " + url);
         }
-        return "OK";
     }
 
     @Override
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpMessageMetric.java	Fri Sep 15 09:04:34 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,279 +0,0 @@
-package com.passus.st.client.http;
-
-import com.passus.commons.Assert;
-import com.passus.commons.metric.Metric;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- *
- * @author Mirosław Hawrot
- */
-public abstract class HttpMessageMetric implements Metric {
-
-    protected static final Map<String, Class> MESSAGE_ATTRS = new HashMap<>();
-
-    static {
-        MESSAGE_ATTRS.put("reqId", String.class);
-        MESSAGE_ATTRS.put("clientIp", String.class);
-        MESSAGE_ATTRS.put("clientPort", Integer.class);
-        MESSAGE_ATTRS.put("serverIp", String.class);
-        MESSAGE_ATTRS.put("serverPort", Integer.class);
-        MESSAGE_ATTRS.put("origClientIp", String.class);
-        MESSAGE_ATTRS.put("origClientPort", Integer.class);
-        MESSAGE_ATTRS.put("origServerIp", String.class);
-        MESSAGE_ATTRS.put("origServerPort", Integer.class);
-        MESSAGE_ATTRS.put("messageHeaderSize", Long.class);
-        MESSAGE_ATTRS.put("messageContentSize", Long.class);
-        MESSAGE_ATTRS.put("timeStart", Long.class);
-        MESSAGE_ATTRS.put("timeStop", Long.class);
-        MESSAGE_ATTRS.put("content", String.class);
-        MESSAGE_ATTRS.put("headers", Map.class);
-        MESSAGE_ATTRS.put("misc", Map.class);
-    }
-
-    private final String name;
-
-    private boolean active;
-
-    private String reqId;
-    private String clientIp;
-    private Integer clientPort;
-    private String serverIp;
-    private Integer serverPort;
-    private String origClientIp;
-    private Integer origClientPort;
-    private String origServerIp;
-    private Integer origServerPort;
-    private Long messageHeaderSize;
-    private Long messageContentSize;
-    private Long timeStart;
-    private Long timeStop;
-    private String content;
-    private HashMap<CharSequence, CharSequence> headers = new HashMap<>();
-    private HashMap<CharSequence, CharSequence> misc = new HashMap<>();
-
-    public HttpMessageMetric(String name) {
-        Assert.notNull(name, "name");
-        this.name = name;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public boolean isActive() {
-        return active;
-    }
-
-    @Override
-    public void activate() {
-        active = true;
-    }
-
-    @Override
-    public void deactivate() {
-        if (!active) {
-            return;
-        }
-
-        reset();
-        active = false;
-    }
-
-    public String getReqId() {
-        return reqId;
-    }
-
-    public void setReqId(String reqId) {
-        this.reqId = reqId;
-    }
-
-    public String getClientIp() {
-        return clientIp;
-    }
-
-    public void setClientIp(String clientIp) {
-        this.clientIp = clientIp;
-    }
-
-    public Integer getClientPort() {
-        return clientPort;
-    }
-
-    public void setClientPort(Integer clientPort) {
-        this.clientPort = clientPort;
-    }
-
-    public String getServerIp() {
-        return serverIp;
-    }
-
-    public void setServerIp(String serverIp) {
-        this.serverIp = serverIp;
-    }
-
-    public Integer getServerPort() {
-        return serverPort;
-    }
-
-    public void setServerPort(Integer serverPort) {
-        this.serverPort = serverPort;
-    }
-
-    public String getOrigClientIp() {
-        return origClientIp;
-    }
-
-    public void setOrigClientIp(String origClientIp) {
-        this.origClientIp = origClientIp;
-    }
-
-    public Integer getOrigClientPort() {
-        return origClientPort;
-    }
-
-    public void setOrigClientPort(Integer origClientPort) {
-        this.origClientPort = origClientPort;
-    }
-
-    public String getOrigServerIp() {
-        return origServerIp;
-    }
-
-    public void setOrigServerIp(String origServerIp) {
-        this.origServerIp = origServerIp;
-    }
-
-    public Integer getOrigServerPort() {
-        return origServerPort;
-    }
-
-    public void setOrigServerPort(Integer origServerPort) {
-        this.origServerPort = origServerPort;
-    }
-
-    public Long getMessageHeaderSize() {
-        return messageHeaderSize;
-    }
-
-    public void setMessageHeaderSize(Long messageHeaderSize) {
-        this.messageHeaderSize = messageHeaderSize;
-    }
-
-    public Long getMessageContentSize() {
-        return messageContentSize;
-    }
-
-    public void setMessageContentSize(Long messageContentSize) {
-        this.messageContentSize = messageContentSize;
-    }
-
-    public Long getTimeStart() {
-        return timeStart;
-    }
-
-    public void setTimeStart(Long timeStart) {
-        this.timeStart = timeStart;
-    }
-
-    public Long getTimeStop() {
-        return timeStop;
-    }
-
-    public void setTimeStop(Long timeStop) {
-        this.timeStop = timeStop;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    public Map<CharSequence, CharSequence> getHeaders() {
-        return headers;
-    }
-
-    public void setHeaders(Map<CharSequence, CharSequence> headers) {
-        this.headers.clear();
-        this.headers.putAll(headers);
-    }
-
-    public Map<CharSequence, CharSequence> getMisc() {
-        return misc;
-    }
-
-    public void setMisc(Map<CharSequence, CharSequence> misc) {
-        this.misc.clear();
-        this.misc.putAll(misc);
-    }
-
-    @Override
-    public Serializable getAttributeValue(String name) {
-        switch (name) {
-            case "reqId":
-                return reqId;
-            case "clientIp":
-                return clientIp;
-            case "clientPort":
-                return clientPort;
-            case "serverIp":
-                return serverIp;
-            case "serverPort":
-                return serverPort;
-            case "origClientIp":
-                return origClientIp;
-            case "origClientPort":
-                return origClientPort;
-            case "origServerIp":
-                return origServerIp;
-            case "origServerPort":
-                return origServerPort;
-            case "messageHeaderSize":
-                return messageHeaderSize;
-            case "messageContentSize":
-                return messageContentSize;
-            case "timeStart":
-                return timeStart;
-            case "timeStop":
-                return timeStop;
-            case "content":
-                return content;
-            case "headers":
-                return headers;
-            case "misc":
-                return misc;
-            default:
-                throw new IllegalArgumentException("Unknown attribute '" + name + "'.");
-        }
-    }
-
-    @Override
-    public Map<String, Serializable> getAttributesValue() {
-        Set<String> names = getAttributesName();
-        Map<String, Serializable> values = new HashMap<>(names.size());
-        for (String name : names) {
-            values.put(name, getAttributeValue(name));
-        }
-
-        return values;
-    }
-
-    @Override
-    public void update(Metric metric) {
-
-    }
-
-    @Override
-    public void reset() {
-
-    }
-
-}
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpReporterClientListener.java	Fri Sep 15 09:04:34 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpReporterClientListener.java	Fri Sep 15 09:59:06 2017 +0200
@@ -15,7 +15,6 @@
 import static com.passus.st.client.http.HttpConsts.TAG_TIME_START;
 import com.passus.st.emitter.SessionInfo;
 import com.passus.st.reporter.server.ReporterClient;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -41,13 +40,44 @@
         ALLOWED_RESP_HEADERS.add(HttpHeaders.CONTENT_TYPE);
     }
 
-    private void populateCommons(String reqId, HttpMessage message, HttpFlowContext context, HttpMessageMetric metric) {
+    private void populateHeaders(Map<CharSequence, CharSequence> dst, Set<ByteString> allowedHeaders, HttpMessage message) {
+        HttpHeaders headers = message.getHeaders();
+        for (ByteString name : allowedHeaders) {
+            ByteString value = headers.get(name);
+            if (value != null) {
+                dst.put(name, value);
+            }
+        }
+    }
+
+    private void populateMisc(Map<CharSequence, CharSequence> misc, HttpFlowContext context, HttpRequest request) {
+        ParametersBag params = context.scopes().getSession(request, false);
+        String username = params == null ? null : (String) params.get(PARAM_USERNAME);
+
+        String sessionId = (String) request.getTag(TAG_SESSION_ID);
+        if (username != null || sessionId != null) {
+            if (username != null) {
+                misc.put("username", username);
+            }
+
+            if (sessionId != null) {
+                misc.put("sessionId", sessionId);
+            }
+        }
+    }
+
+    @Override
+    public void responseReceived(HttpRequest request, HttpResponse response, HttpFlowContext context) {
+        if (request == null && response == null) {
+            return;
+        }
+
         SessionInfo session = context.sessionInfo();
         SocketAddress localAddress = context.channelContext.getLocalAddress();
         SocketAddress remoteAddress = context.channelContext.getRemoteAddress();
-        Set<ByteString> alloweHeaders = message.isRequest() ? ALLOWED_REQ_HEADERS : ALLOWED_RESP_HEADERS;
 
-        metric.setReqId(reqId);
+        HttpRequestResponseMetric metric = new HttpRequestResponseMetric();
+
         metric.setClientIp(localAddress.getIp().toString());
         metric.setClientPort(localAddress.getPort());
         metric.setServerIp(remoteAddress.getIp().toString());
@@ -56,62 +86,36 @@
         metric.setOrigClientPort(session.getSrcPort());
         metric.setOrigServerIp(session.getDstIp().toString());
         metric.setOrigServerPort(session.getDstPort());
-        metric.setMessageHeaderSize((Long) message.getTag(TAG_HEADER_SIZE));
-        metric.setMessageContentSize((Long) message.getTag(TAG_CONTENT_SIZE));
-        metric.setTimeStart((Long) message.getTag(TAG_TIME_START));
-        metric.setTimeStop((Long) message.getTag(TAG_TIME_END));
-        
-        Map<CharSequence, CharSequence> headersMap = new HashMap<>();
-        HttpHeaders headers = message.getHeaders();
-        for (ByteString name : alloweHeaders) {
-            ByteString value = headers.get(name);
-            if (value != null) {
-                headersMap.put(name, value);
-            }
-        }
-
-        metric.setHeaders(headersMap);
-        ParametersBag params = context.scopes().getSession(message, false);
-        String username = null;
-        if (params != null) {
-            username = (String) params.get(PARAM_USERNAME);
-        }
-
-        String sessionId = (String) message.getTag(TAG_SESSION_ID);
-        if (username != null || sessionId != null) {
-            Map<CharSequence, CharSequence> misc = new HashMap<>(2);
-            if (username != null) {
-                misc.put("username", username);
-            }
-
-            if (sessionId != null) {
-                misc.put("sessionId", sessionId);
-            }
-
-            metric.setMisc(misc);
-        }
-    }
-
-    @Override
-    public void responseReceived(HttpRequest request, HttpResponse response, HttpFlowContext context) {
-        String reqId = request == null ? null : request.getId();
 
         if (request != null) {
-            HttpRequestMetric reqMetric = new HttpRequestMetric();
-            reqMetric.setReqMethod(request.getMethod().toString());
-            reqMetric.setUrl(request.getUrl());
-            reqMetric.setVersion(request.getVersion());
-            populateCommons(reqId, request, context, reqMetric);
-            reporterClient.send(reqMetric);
+            metric.setReqId(request.getId());
+            populateHeaders(metric.getReqHdrs(), ALLOWED_REQ_HEADERS, request);
+            populateMisc(metric.getMisc(), context, request);
+
+            metric.setReqHdrSize((Long) request.getTag(TAG_HEADER_SIZE));
+            metric.setReqCntSize((Long) request.getTag(TAG_CONTENT_SIZE));
+            metric.setReqStart((Long) request.getTag(TAG_TIME_START));
+            metric.setReqStop((Long) request.getTag(TAG_TIME_END));
+
+            metric.setMethod(request.getMethod().toString());
+            metric.setUrl(request.getUrl().toString());
+            metric.setReqVersion(request.getVersion().toString());
         }
 
         if (response != null) {
-            HttpResponseMetric respMetric = new HttpResponseMetric();
-            respMetric.setStatusCode(response.getStatus().getCode());
-            respMetric.setReason(response.getStatus().getReasonPhrase());
-            populateCommons(reqId, response, context, respMetric);
-            reporterClient.send(respMetric);
+            populateHeaders(metric.getRespHdrs(), ALLOWED_RESP_HEADERS, response);
+
+            metric.setRespHdrSize((Long) response.getTag(TAG_HEADER_SIZE));
+            metric.setRespCntSize((Long) response.getTag(TAG_CONTENT_SIZE));
+            metric.setRespStart((Long) response.getTag(TAG_TIME_START));
+            metric.setRespStop((Long) response.getTag(TAG_TIME_END));
+
+            metric.setCode(response.getStatus().getCode());
+            metric.setReason(response.getStatus().getReasonPhrase().toString());
+            metric.setRespVersion(response.getVersion().toString());
         }
+
+        reporterClient.send(metric);
     }
 
 }
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpRequestMetric.java	Fri Sep 15 09:04:34 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-package com.passus.st.client.http;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- *
- * @author Mirosław Hawrot
- */
-public final class HttpRequestMetric extends HttpMessageMetric {
-
-    protected static final Map<String, Class> ATTRS;
-
-    static {
-        Map<String, Class> attrs = new HashMap<>();
-        attrs.put("reqMethod", String.class);
-        attrs.put("version", String.class);
-        attrs.put("url", String.class);
-        attrs.putAll(MESSAGE_ATTRS);
-        ATTRS = Collections.unmodifiableMap(attrs);
-    }
-
-    private CharSequence reqMethod;
-
-    private CharSequence version;
-
-    private CharSequence url;
-
-    public HttpRequestMetric() {
-        super("httpRequest");
-
-    }
-
-    public CharSequence getReqMethod() {
-        return reqMethod;
-    }
-
-    public void setReqMethod(CharSequence reqMethod) {
-        this.reqMethod = reqMethod;
-    }
-
-    public CharSequence getVersion() {
-        return version;
-    }
-
-    public void setVersion(CharSequence version) {
-        this.version = version;
-    }
-
-    public CharSequence getUrl() {
-        return url;
-    }
-
-    public void setUrl(CharSequence url) {
-        this.url = url;
-    }
-
-    @Override
-    public Serializable getAttributeValue(String name) {
-        switch (name) {
-            case "reqMethod":
-                return (Serializable) reqMethod;
-            case "version":
-                return (Serializable) version;
-            case "url":
-                return (Serializable) url;
-            default:
-                return super.getAttributeValue(name);
-        }
-
-    }
-
-    @Override
-    public Class getAttributeClass(String name) {
-        Class clazz = ATTRS.get(name);
-        if (clazz == null) {
-            throw new IllegalArgumentException("No such attribute '" + name + "'.");
-        }
-
-        return clazz;
-    }
-
-    @Override
-    public boolean hasAttribute(String name) {
-        return ATTRS.containsKey(name);
-    }
-
-    @Override
-    public Set<String> getAttributesName() {
-        return ATTRS.keySet();
-    }
-
-   
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpRequestResponseMetric.java	Fri Sep 15 09:59:06 2017 +0200
@@ -0,0 +1,462 @@
+package com.passus.st.client.http;
+
+import com.passus.commons.Assert;
+import com.passus.commons.metric.Metric;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class HttpRequestResponseMetric implements Metric {
+    
+    protected static final Map<String, Class> ATTRS;
+    
+    static {
+        Map<String, Class> attrs = new HashMap<>();
+        attrs.put(Constants.clientIp, String.class);
+        attrs.put(Constants.clientPort, Integer.class);
+        attrs.put(Constants.serverIp, String.class);
+        attrs.put(Constants.serverPort, Integer.class);
+        attrs.put(Constants.origClientIp, String.class);
+        attrs.put(Constants.origClientPort, Integer.class);
+        attrs.put(Constants.origServerIp, String.class);
+        attrs.put(Constants.origServerPort, Integer.class);
+        
+        attrs.put(Constants.reqId, String.class);
+        attrs.put(Constants.reqHdrs, Map.class);
+        attrs.put(Constants.respHdrs, Map.class);
+        attrs.put(Constants.misc, Map.class);
+        
+        attrs.put(Constants.reqHdrSize, Long.class);
+        attrs.put(Constants.reqCntSize, Long.class);
+        attrs.put(Constants.reqStart, Long.class);
+        attrs.put(Constants.reqStop, Long.class);
+        attrs.put(Constants.method, String.class);
+        attrs.put(Constants.url, String.class);
+        attrs.put(Constants.reqVersion, String.class);
+        
+        attrs.put(Constants.respHdrSize, Long.class);
+        attrs.put(Constants.respCntSize, Long.class);
+        attrs.put(Constants.respStart, Long.class);
+        attrs.put(Constants.respStop, Long.class);
+        attrs.put(Constants.code, Integer.class);
+        attrs.put(Constants.reason, String.class);
+        attrs.put(Constants.respVersion, String.class);
+        
+        ATTRS = Collections.unmodifiableMap(attrs);
+    }
+    
+    private final String name = "httpRequestResponse";
+    
+    private boolean active;
+    
+    private String clientIp;
+    private Integer clientPort;
+    private String serverIp;
+    private Integer serverPort;
+    private String origClientIp;
+    private Integer origClientPort;
+    private String origServerIp;
+    private Integer origServerPort;
+    
+    private String reqId;
+    private HashMap<CharSequence, CharSequence> reqHdrs = new HashMap<>();
+    private HashMap<CharSequence, CharSequence> respHdrs = new HashMap<>();
+    private HashMap<CharSequence, CharSequence> misc = new HashMap<>();
+    
+    private Long reqHdrSize;
+    private Long reqCntSize;
+    private Long reqStart;
+    private Long reqStop;
+    
+    private String method;
+    private String url;
+    private String reqVersion;
+    
+    private Long respHdrSize;
+    private Long respCntSize;
+    private Long respStart;
+    private Long respStop;
+    
+    private Integer code;
+    private String reason;
+    private String respVersion;
+    
+//<editor-fold defaultstate="collapsed" desc="get set">
+    public String getClientIp() {
+        return clientIp;
+    }
+    
+    public void setClientIp(String clientIp) {
+        this.clientIp = clientIp;
+    }
+    
+    public Integer getClientPort() {
+        return clientPort;
+    }
+    
+    public void setClientPort(Integer clientPort) {
+        this.clientPort = clientPort;
+    }
+    
+    public String getServerIp() {
+        return serverIp;
+    }
+    
+    public void setServerIp(String serverIp) {
+        this.serverIp = serverIp;
+    }
+    
+    public Integer getServerPort() {
+        return serverPort;
+    }
+    
+    public void setServerPort(Integer serverPort) {
+        this.serverPort = serverPort;
+    }
+    
+    public String getOrigClientIp() {
+        return origClientIp;
+    }
+    
+    public void setOrigClientIp(String origClientIp) {
+        this.origClientIp = origClientIp;
+    }
+    
+    public Integer getOrigClientPort() {
+        return origClientPort;
+    }
+    
+    public void setOrigClientPort(Integer origClientPort) {
+        this.origClientPort = origClientPort;
+    }
+    
+    public String getOrigServerIp() {
+        return origServerIp;
+    }
+    
+    public void setOrigServerIp(String origServerIp) {
+        this.origServerIp = origServerIp;
+    }
+    
+    public Integer getOrigServerPort() {
+        return origServerPort;
+    }
+    
+    public void setOrigServerPort(Integer origServerPort) {
+        this.origServerPort = origServerPort;
+    }
+    
+    public String getReqId() {
+        return reqId;
+    }
+    
+    public void setReqId(String reqId) {
+        this.reqId = reqId;
+    }
+    
+    public HashMap<CharSequence, CharSequence> getReqHdrs() {
+        return reqHdrs;
+    }
+    
+    public void setReqHdrs(HashMap<CharSequence, CharSequence> reqHdrs) {
+        this.reqHdrs = reqHdrs;
+    }
+    
+    public HashMap<CharSequence, CharSequence> getRespHdrs() {
+        return respHdrs;
+    }
+    
+    public void setRespHdrs(HashMap<CharSequence, CharSequence> respHdrs) {
+        this.respHdrs = respHdrs;
+    }
+    
+    public HashMap<CharSequence, CharSequence> getMisc() {
+        return misc;
+    }
+    
+    public void setMisc(HashMap<CharSequence, CharSequence> misc) {
+        this.misc = misc;
+    }
+    
+    public Long getReqHdrSize() {
+        return reqHdrSize;
+    }
+    
+    public void setReqHdrSize(Long reqHdrSize) {
+        this.reqHdrSize = reqHdrSize;
+    }
+    
+    public Long getReqCntSize() {
+        return reqCntSize;
+    }
+    
+    public void setReqCntSize(Long reqCntSize) {
+        this.reqCntSize = reqCntSize;
+    }
+    
+    public Long getReqStart() {
+        return reqStart;
+    }
+    
+    public void setReqStart(Long reqStart) {
+        this.reqStart = reqStart;
+    }
+    
+    public Long getReqStop() {
+        return reqStop;
+    }
+    
+    public void setReqStop(Long reqStop) {
+        this.reqStop = reqStop;
+    }
+    
+    public String getMethod() {
+        return method;
+    }
+    
+    public void setMethod(String method) {
+        this.method = method;
+    }
+    
+    public String getUrl() {
+        return url;
+    }
+    
+    public void setUrl(String url) {
+        this.url = url;
+    }
+    
+    public String getReqVersion() {
+        return reqVersion;
+    }
+    
+    public void setReqVersion(String reqVersion) {
+        this.reqVersion = reqVersion;
+    }
+    
+    public Long getRespHdrSize() {
+        return respHdrSize;
+    }
+    
+    public void setRespHdrSize(Long respHdrSize) {
+        this.respHdrSize = respHdrSize;
+    }
+    
+    public Long getRespCntSize() {
+        return respCntSize;
+    }
+    
+    public void setRespCntSize(Long respCntSize) {
+        this.respCntSize = respCntSize;
+    }
+    
+    public Long getRespStart() {
+        return respStart;
+    }
+    
+    public void setRespStart(Long respStart) {
+        this.respStart = respStart;
+    }
+    
+    public Long getRespStop() {
+        return respStop;
+    }
+    
+    public void setRespStop(Long respStop) {
+        this.respStop = respStop;
+    }
+    
+    public Integer getCode() {
+        return code;
+    }
+    
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+    
+    public String getReason() {
+        return reason;
+    }
+    
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+    
+    public String getRespVersion() {
+        return respVersion;
+    }
+    
+    public void setRespVersion(String respVersion) {
+        this.respVersion = respVersion;
+    }
+//</editor-fold>
+
+    @Override
+    public String getName() {
+        return name;
+    }
+    
+    @Override
+    public boolean isActive() {
+        return active;
+    }
+    
+    @Override
+    public void activate() {
+        active = true;
+    }
+    
+    @Override
+    public void deactivate() {
+        if (!active) {
+            return;
+        }
+        
+        reset();
+        active = false;
+    }
+    
+    @Override
+    public Class getAttributeClass(String name) {
+        Class clazz = ATTRS.get(name);
+        if (clazz == null) {
+            throw new IllegalArgumentException("No such attribute '" + name + "'.");
+        }
+        
+        return clazz;
+    }
+    
+    @Override
+    public boolean hasAttribute(String name) {
+        return ATTRS.containsKey(name);
+    }
+    
+    @Override
+    public Set<String> getAttributesName() {
+        return ATTRS.keySet();
+    }
+    
+    @Override
+    public Serializable getAttributeValue(String name) {
+        switch (name) {
+            case Constants.clientIp:
+                return clientIp;
+            case Constants.clientPort:
+                return clientPort;
+            case Constants.serverIp:
+                return serverIp;
+            case Constants.serverPort:
+                return serverPort;
+            case Constants.origClientIp:
+                return origClientIp;
+            case Constants.origClientPort:
+                return origClientPort;
+            case Constants.origServerIp:
+                return origServerIp;
+            case Constants.origServerPort:
+                return origServerPort;
+            
+            case Constants.reqId:
+                return reqId;
+            case Constants.reqHdrs:
+                return reqHdrs;
+            case Constants.respHdrs:
+                return respHdrs;
+            case Constants.misc:
+                return misc;
+            
+            case Constants.reqHdrSize:
+                return reqHdrSize;
+            case Constants.reqCntSize:
+                return reqCntSize;
+            case Constants.reqStart:
+                return reqStart;
+            case Constants.reqStop:
+                return reqStop;
+            case Constants.method:
+                return method;
+            case Constants.url:
+                return url;
+            case Constants.reqVersion:
+                return reqVersion;
+            
+            case Constants.respHdrSize:
+                return respHdrSize;
+            case Constants.respCntSize:
+                return respCntSize;
+            case Constants.respStart:
+                return respStart;
+            case Constants.respStop:
+                return respStop;
+            case Constants.code:
+                return code;
+            case Constants.reason:
+                return reason;
+            case Constants.respVersion:
+                return respVersion;
+            default:
+                throw new IllegalArgumentException("Unknown attribute '" + name + "'.");
+        }
+    }
+    
+    @Override
+    public Map<String, Serializable> getAttributesValue() {
+        Set<String> names = getAttributesName();
+        Map<String, Serializable> values = new HashMap<>(names.size());
+        for (String name : names) {
+            values.put(name, getAttributeValue(name));
+        }
+        
+        return values;
+    }
+    
+    @Override
+    public void update(Metric metric) {
+        
+    }
+    
+    @Override
+    public void reset() {
+        
+    }
+    
+    public static final class Constants {
+        
+        public static final String clientIp = "clientIp";
+        public static final String clientPort = "clientPort";
+        public static final String serverIp = "serverIp";
+        public static final String serverPort = "serverPort";
+        public static final String origClientIp = "origClientIp";
+        public static final String origClientPort = "origClientPort";
+        public static final String origServerIp = "origServerIp";
+        public static final String origServerPort = "origServerPort";
+        
+        public static final String reqId = "reqId";
+        public static final String reqHdrs = "reqHdrs";
+        public static final String respHdrs = "respHdrs";
+        public static final String misc = "misc";
+        
+        public static final String reqHdrSize = "reqHdrSize";
+        public static final String reqCntSize = "reqCntSize";
+        public static final String reqStart = "reqStart";
+        public static final String reqStop = "reqStop";
+        public static final String method = "method";
+        public static final String url = "url";
+        public static final String reqVersion = "reqVersion";
+        
+        public static final String respHdrSize = "respHdrSize";
+        public static final String respCntSize = "respCntSize";
+        public static final String respStart = "respStart";
+        public static final String respStop = "respStop";
+        public static final String code = "code";
+        public static final String reason = "reason";
+        public static final String respVersion = "respVersion";
+        
+    }
+}
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpResponseMetric.java	Fri Sep 15 09:04:34 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-package com.passus.st.client.http;
-
-import static com.passus.st.client.http.HttpMessageMetric.MESSAGE_ATTRS;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- *
- * @author Mirosław Hawrot
- */
-public final class HttpResponseMetric extends HttpMessageMetric {
-
-    protected static final Map<String, Class> ATTRS;
-
-    static {
-        Map<String, Class> attrs = new HashMap<>();
-        attrs.put("statusCode", Integer.class);
-        attrs.put("version", String.class);
-        attrs.put("reason", String.class);
-        attrs.putAll(MESSAGE_ATTRS);
-        ATTRS = Collections.unmodifiableMap(attrs);
-    }
-
-    private Integer statusCode;
-
-    private CharSequence version;
-
-    private CharSequence reason;
-
-    public HttpResponseMetric() {
-        super("httpResponse");
-    }
-
-    public Integer getStatusCode() {
-        return statusCode;
-    }
-
-    public void setStatusCode(Integer statusCode) {
-        this.statusCode = statusCode;
-    }
-
-    public CharSequence getVersion() {
-        return version;
-    }
-
-    public void setVersion(CharSequence version) {
-        this.version = version;
-    }
-
-    public CharSequence getReason() {
-        return reason;
-    }
-
-    public void setReason(CharSequence reason) {
-        this.reason = reason;
-    }
-
-    @Override
-    public Serializable getAttributeValue(String name) {
-        switch (name) {
-            case "statusCode":
-                return statusCode;
-            case "version":
-                return (Serializable) version;
-            case "reason":
-                return (Serializable) reason;
-            default:
-                return super.getAttributeValue(name);
-        }
-
-    }
-
-    @Override
-    public Class getAttributeClass(String name) {
-        Class clazz = ATTRS.get(name);
-        if (clazz == null) {
-            throw new IllegalArgumentException("No such attribute '" + name + "'.");
-        }
-
-        return clazz;
-    }
-
-    @Override
-    public boolean hasAttribute(String name) {
-        return ATTRS.containsKey(name);
-    }
-
-    @Override
-    public Set<String> getAttributesName() {
-        return ATTRS.keySet();
-    }
-}