Mercurial > stress-tester
changeset 541:83f45c3b4c3d
reporter - real IP/port
author | Devel 1 |
---|---|
date | Tue, 12 Sep 2017 16:22:53 +0200 |
parents | 55753289dafa |
children | 24749a1ca61d |
files | stress-tester/src/main/java/com/passus/st/client/http/HttpMessageMetric.java stress-tester/src/main/java/com/passus/st/client/http/HttpReporterClientListener.java |
diffstat | 2 files changed, 60 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpMessageMetric.java Tue Sep 12 12:13:59 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpMessageMetric.java Tue Sep 12 16:22:53 2017 +0200 @@ -1,10 +1,7 @@ package com.passus.st.client.http; import com.passus.commons.Assert; -import com.passus.commons.metric.GenericMetric; import com.passus.commons.metric.Metric; -import com.passus.net.http.HttpMessage; -import com.passus.st.emitter.SessionInfo; import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -24,6 +21,10 @@ 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); @@ -38,27 +39,20 @@ 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) { @@ -131,6 +125,38 @@ 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; } @@ -202,6 +228,14 @@ 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":
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpReporterClientListener.java Tue Sep 12 12:13:59 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpReporterClientListener.java Tue Sep 12 16:22:53 2017 +0200 @@ -1,6 +1,7 @@ package com.passus.st.client.http; import com.passus.data.ByteString; +import com.passus.net.SocketAddress; import com.passus.net.http.HttpHeaders; import com.passus.net.http.HttpMessage; import com.passus.net.http.HttpRequest; @@ -42,12 +43,19 @@ private void populateCommons(String reqId, HttpMessage message, HttpFlowContext context, HttpMessageMetric metric) { 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); - metric.setClientIp(session.getSrcIp().toString()); - metric.setClientPort(session.getSrcPort()); - metric.setServerIp(session.getDstIp().toString()); - metric.setServerPort(session.getDstPort()); + metric.setClientIp(localAddress.getIp().toString()); + metric.setClientPort(localAddress.getPort()); + metric.setServerIp(remoteAddress.getIp().toString()); + metric.setServerPort(remoteAddress.getPort()); + metric.setOrigClientIp(session.getSrcIp().toString()); + 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));