changeset 1263:785eedda2370

flow - JSON formatting
author Devel 1
date Thu, 02 Jul 2020 14:55:47 +0200
parents 4682303ee2ed
children 25f8930e76c9
files stress-tester/src/main/java/com/passus/st/scanner/FlowAnalyzerCommand.java stress-tester/src/main/java/com/passus/st/scanner/HttpUrlSequencePayloadAnalyzer.java stress-tester/src/main/resources/flow_analyzer.py
diffstat 3 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/scanner/FlowAnalyzerCommand.java	Thu Jul 02 13:26:17 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/scanner/FlowAnalyzerCommand.java	Thu Jul 02 14:55:47 2020 +0200
@@ -34,7 +34,7 @@
     int lmax = DEFAULT_LMAX;
     int maxSeq = DEFAULT_MAX_SEQ;
     boolean fold = DEFAULT_FOLD;
-    List<String> cleanRules;
+    List<String> ignoredUrls;
 
     void run() throws IOException, InterruptedException {
         checkExists(scriptPath, "scriptPath");
@@ -50,9 +50,9 @@
         if (fold) {
             commandLine.add("--fold");
         }
-        if (cleanRules != null) {
+        if (ignoredUrls != null) {
             commandLine.add("-c");
-            commandLine.addAll(cleanRules);
+            commandLine.addAll(ignoredUrls);
         }
 
         ProcessBuilder pb = new ProcessBuilder(commandLine);
--- a/stress-tester/src/main/java/com/passus/st/scanner/HttpUrlSequencePayloadAnalyzer.java	Thu Jul 02 13:26:17 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/scanner/HttpUrlSequencePayloadAnalyzer.java	Thu Jul 02 14:55:47 2020 +0200
@@ -70,7 +70,7 @@
         command.lmax = config.getInteger("lmax", FlowAnalyzerCommand.DEFAULT_LMAX);
         command.maxSeq = config.getInteger("maxSeq", FlowAnalyzerCommand.DEFAULT_MAX_SEQ);
         command.fold = config.getBoolean("fold", FlowAnalyzerCommand.DEFAULT_FOLD);
-        command.cleanRules = config.getList("cleanRules");
+        command.ignoredUrls = config.getList("ignoredUrls");
     }
 
     @Override
@@ -131,6 +131,7 @@
         HttpResponse resp = (HttpResponse) event.getResponse();
         if (req != null) {
             String uri = req.getUri().toString();
+            // normalizacja URL
             String method = req.getMethod().toString();
             String datetime = sdf.format(new Date(req.getTimestamp()));
             String userId = userIdExtractor.extract(event);
@@ -231,7 +232,7 @@
             return mapDef(
                     tupleDef("userIdSource", STRING_DEF).setRequired(false),
                     tupleDef("dataPath", STRING_DEF).setRequired(false),
-                    tupleDef("cleanRules", listDef()).setRequired(false),
+                    tupleDef("ignoredUrls", listDef()).setRequired(false),
                     tupleDef("fold", BOOLEAN_DEF).setRequired(false),
                     tupleDef("pmin", FLOAT_GREATER_EQUAL_ZERO_DEF).setRequired(false),
                     tupleDef("lmin", INT_GREATER_THAN_ZERO_DEF).setRequired(false),
--- a/stress-tester/src/main/resources/flow_analyzer.py	Thu Jul 02 13:26:17 2020 +0200
+++ b/stress-tester/src/main/resources/flow_analyzer.py	Thu Jul 02 14:55:47 2020 +0200
@@ -744,7 +744,7 @@
         suffix = 'f' if args.fold else ''
         # for metrics and generator
         with open("seq_L{}{}_out.json".format(length, suffix), "w") as f:
-            json.dump(out, f)
+            json.dump(out, f, indent=4)
         # debug
         with open("seq_L{}{}_stats.json".format(length, suffix), "w") as f:
-            json.dump(stats, f)
+            json.dump(stats, f, indent=4)