Mercurial > stress-tester
changeset 657:91a8438f1c5e
reporter - markers
author | Devel 1 |
---|---|
date | Thu, 09 Nov 2017 15:50:40 +0100 |
parents | 3f78fb8409fb |
children | c310cbb9c8ff |
files | stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java stress-tester/src/main/java/com/passus/st/client/http/HttpRequestResponseMetric.java stress-tester/src/main/java/com/passus/st/client/http/ReporterDestination.java stress-tester/src/main/java/com/passus/st/client/http/ReporterFileDestination.java stress-tester/src/main/java/com/passus/st/client/http/ReporterRemoteDestination.java stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMarkFilter.java |
diffstat | 6 files changed, 55 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java Thu Nov 09 15:21:06 2017 +0100 +++ b/stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java Thu Nov 09 15:50:40 2017 +0100 @@ -101,6 +101,7 @@ addValue(builder, getValue(misc, "sessionId")); addValue(builder, getValue(misc, "username")); addValue(builder, getValue(fields, "loopInfo")); + addValue(builder, getValue(fields, "reqMarkers")); reqFile.println(builder.toString()); reqFile.flush(); builder.setLength(0); @@ -114,6 +115,7 @@ addValue(builder, getValue(respHdrs, "Content-Type")); addValue(builder, getValue(fields, "respHdrSize")); addValue(builder, getValue(fields, "respCntSize")); + addValue(builder, getValue(fields, "reqMarkers")); respFile.println(builder.toString()); respFile.flush(); builder.setLength(0);
--- a/stress-tester/src/main/java/com/passus/st/client/http/HttpRequestResponseMetric.java Thu Nov 09 15:21:06 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/client/http/HttpRequestResponseMetric.java Thu Nov 09 15:50:40 2017 +0100 @@ -40,6 +40,7 @@ attrs.put(Constants.method, String.class); attrs.put(Constants.url, String.class); attrs.put(Constants.reqVersion, String.class); + attrs.put(Constants.reqMarkers, String.class); attrs.put(Constants.respHdrSize, Long.class); attrs.put(Constants.respCntSize, Long.class); @@ -48,6 +49,7 @@ attrs.put(Constants.code, Integer.class); attrs.put(Constants.reason, String.class); attrs.put(Constants.respVersion, String.class); + attrs.put(Constants.respMarkers, String.class); ATTRS = Collections.unmodifiableMap(attrs); } @@ -79,6 +81,7 @@ private String method; private String url; private String reqVersion; + private String reqMarkers; private Long respHdrSize; private Long respCntSize; @@ -88,6 +91,7 @@ private Integer code; private String reason; private String respVersion; + private String respMarkers; //<editor-fold defaultstate="collapsed" desc="get set"> public String getClientIp() { @@ -250,6 +254,14 @@ this.reqVersion = reqVersion; } + public String getReqMarkers() { + return reqMarkers; + } + + public void setReqMarkers(String reqMarkers) { + this.reqMarkers = reqMarkers; + } + public Long getRespHdrSize() { return respHdrSize; } @@ -305,6 +317,14 @@ public void setRespVersion(String respVersion) { this.respVersion = respVersion; } + + public String getRespMarkers() { + return respMarkers; + } + + public void setRespMarkers(String respMarkers) { + this.respMarkers = respMarkers; + } //</editor-fold> @Override @@ -397,6 +417,8 @@ return url; case Constants.reqVersion: return reqVersion; + case Constants.reqMarkers: + return reqMarkers; case Constants.respHdrSize: return respHdrSize; @@ -412,6 +434,8 @@ return reason; case Constants.respVersion: return respVersion; + case Constants.respMarkers: + return respMarkers; default: throw new IllegalArgumentException("Unknown attribute '" + name + "'."); } @@ -462,6 +486,7 @@ public static final String method = "method"; public static final String url = "url"; public static final String reqVersion = "reqVersion"; + public static final String reqMarkers = "reqMarkers"; public static final String respHdrSize = "respHdrSize"; public static final String respCntSize = "respCntSize"; @@ -470,6 +495,7 @@ public static final String code = "code"; public static final String reason = "reason"; public static final String respVersion = "respVersion"; + public static final String respMarkers = "respMarkers"; } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterDestination.java Thu Nov 09 15:21:06 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterDestination.java Thu Nov 09 15:50:40 2017 +0100 @@ -2,10 +2,12 @@ import com.passus.data.ByteString; import com.passus.net.http.HttpHeaders; +import com.passus.net.http.HttpMessage; import com.passus.st.client.http.filter.HttpSequenceListener; import com.passus.st.metric.MetricsCollectionHandler; import java.util.Arrays; import java.util.HashSet; +import java.util.List; import java.util.Set; /** @@ -29,4 +31,21 @@ int loop = context.getParameters().getLoop(); return sourceName + "_loop" + loop; } + + public static String getMarkers(HttpMessage msg) { + Object object = msg.getTag(HttpConsts.TAG_MARKER); + if (object instanceof List) { + StringBuilder sb = new StringBuilder(); + List list = (List) object; + for (Object el : list) { + if (sb.length() > 0) { + sb.append(','); + } + sb.append(object.toString()); + } + return sb.toString(); + } else { + return ""; + } + } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterFileDestination.java Thu Nov 09 15:21:06 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterFileDestination.java Thu Nov 09 15:50:40 2017 +0100 @@ -104,6 +104,7 @@ addValue(builder, misc.get("sessionId")); addValue(builder, misc.get("username")); addValue(builder, ReporterDestination.getLoopInfo(context)); + addValue(builder, ReporterDestination.getMarkers(request)); } else { addValue(builder, null); } @@ -127,6 +128,7 @@ addValue(builder, response.getTag(TAG_HEADER_SIZE)); addValue(builder, response.getTag(TAG_CONTENT_SIZE)); + addValue(builder, ReporterDestination.getMarkers(response)); } else { addValue(builder, reqId); }
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterRemoteDestination.java Thu Nov 09 15:21:06 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterRemoteDestination.java Thu Nov 09 15:50:40 2017 +0100 @@ -100,6 +100,7 @@ metric.setMethod(request.getMethod().toString()); metric.setUrl(request.getUrl().toString()); metric.setReqVersion(request.getVersion().toString()); + metric.setReqMarkers(ReporterDestination.getMarkers(request)); } if (response != null) { @@ -113,6 +114,7 @@ metric.setCode(response.getStatus().getCode()); metric.setReason(response.getStatus().getReasonPhrase().toString()); metric.setRespVersion(response.getVersion().toString()); + metric.setRespMarkers(ReporterDestination.getMarkers(request)); } reporterClient.send(metric);
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMarkFilter.java Thu Nov 09 15:21:06 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMarkFilter.java Thu Nov 09 15:50:40 2017 +0100 @@ -123,6 +123,10 @@ return message; } + @Override + public String toString() { + return category + ":" + message; + } } public static class MarkerRule {