This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new e7e96af  DISPATCH-1558: Adjust Scraper to handle new logging module
e7e96af is described below

commit e7e96af1d4128c71c778d29577e25fca3c5e9c23
Author: Chuck Rolke <[email protected]>
AuthorDate: Wed Jan 29 11:15:28 2020 -0500

    DISPATCH-1558: Adjust Scraper to handle new logging module
---
 tools/scraper/README.md       | 16 ++++++++++++----
 tools/scraper/log_splitter.py | 14 +++++++++++++-
 tools/scraper/parser.py       | 30 ++++++++++++++++++------------
 3 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/tools/scraper/README.md b/tools/scraper/README.md
index 8461575..093fd92 100644
--- a/tools/scraper/README.md
+++ b/tools/scraper/README.md
@@ -161,15 +161,23 @@ and divides the connection data. Connection names inclued 
the router instance ID
 * Enable router logging
 
 The routers need to generate proper logging for Scraper.
-The information classes are exposed by enabling log levels.
+Expose the information in router logs that Scraper requires by 
+enabling specific log levels for some of the router logging modules.
 
-| Log level      | Information               |
+| Log module and level | Information exposed in logs |
 |----------------|---------------------------|
 | ROUTER info    | Router version            |
 | SERVER info    | Router restart discovery  |
-| SERVER trace   | AMQP control and data     |
+| SERVER trace   | AMQP control and data - versions 1.10 and earlier |
+| PROTOCOL trace | AMQP control and data - versions 1.11 and later   |
 | ROUTER_LS info | Router link state reports |
 
+* Enable version-specific router logging
+
+| Version          | SERVER trace                | PROTOCOL trace         |
+|------------------|-----------------------------|------------------------|
+| 1.10 and earlier | Required                    | Error - do not specify |
+| 1.11 and later   | Do not specify - clutters log file with info that Scraper 
does not use | Required |
 
 * Run your tests to populate log files used as Scraper input.
 
@@ -207,7 +215,7 @@ The information classes are exposed by enabling log levels.
       --files FILES [FILES ...], -f FILES [FILES ...]
 
 * Split mode works with a single file and ignores all other switches
-* Normal mode (no --split switch) accepts other swithces and multiple files
+* Normal mode (no --split switch) accepts other switches and multiple files
 
 ### Switch --skip-all-data
     tools/scraper/scraper.py --skip-all-data -f FILE [FILE ...]
diff --git a/tools/scraper/log_splitter.py b/tools/scraper/log_splitter.py
index 72f03b8..b7ff480 100755
--- a/tools/scraper/log_splitter.py
+++ b/tools/scraper/log_splitter.py
@@ -119,7 +119,10 @@ class parsed_attach():
         key_strace = "SERVER (trace) ["
         sti = self.line.find(key_strace)
         if sti < 0:
-            raise ValueError("'%s' not found in line %s" % (key_strace, 
self.line))
+            key_strace = "PROTOCOL (trace) ["
+            sti = self.line.find(key_strace)
+            if sti < 0:
+                raise ValueError("'%s' not found in line %s" % (key_strace, 
self.line))
         self.line = self.line[sti + len(key_strace):]
         ste = self.line.find(']')
         if ste < 0:
@@ -223,6 +226,7 @@ class LogFile:
         """
         key_sstart = "SERVER (info) Container Name:"  # Normal 'router is 
starting' restart discovery line
         key_strace = "SERVER (trace) ["  # AMQP traffic
+        key_ptrace = "PROTOCOL (trace) [" # AMQP traffic
         key_error = "@error(29)"
         key_openin = "<- @open(16)"
         key_xfer = "@transfer"
@@ -236,10 +240,18 @@ class LogFile:
             self.instance += 1
             self.restarts.append(line)
         else:
+            found = False
             if self.parse_identify(key_strace, line):
                 self.amqp_lines += 1
                 idx = line.find(key_strace)
                 idx += len(key_strace)
+                found = True
+            elif self.parse_identify(key_ptrace, line):
+                self.amqp_lines += 1
+                idx = line.find(key_ptrace)
+                idx += len(key_ptrace)
+                found = True
+            if found:
                 eidx = line.find("]", idx + 1)
                 conn_id = line[idx:eidx]
                 keyname = connection.keyname(self.instance, conn_id)
diff --git a/tools/scraper/parser.py b/tools/scraper/parser.py
index d2e59ce..1ebb1d0 100755
--- a/tools/scraper/parser.py
+++ b/tools/scraper/parser.py
@@ -371,6 +371,7 @@ class ParsedLogLine(object):
     ** common             common block object
     """
     server_trace_key = "SERVER (trace) ["
+    protocol_trace_key = "PROTOCOL (trace) ["
     server_info_key = "SERVER (info) ["
     policy_trace_key = "POLICY (trace) ["
     router_ls_key = "ROUTER_LS (info)"
@@ -767,6 +768,7 @@ class ParsedLogLine(object):
         :param _router:
         """
         if not (ParsedLogLine.server_trace_key in _line or
+                ParsedLogLine.protocol_trace_key in _line or
                 (ParsedLogLine.policy_trace_key in _line and "lookup_user:" in 
_line) or  # open (not begin, attach)
                 ParsedLogLine.server_info_key in _line or
                 ParsedLogLine.router_ls_key in _line):
@@ -835,24 +837,28 @@ class ParsedLogLine(object):
         # extract connection number
         sti = self.line.find(self.server_trace_key)
         if sti < 0:
-            sti = self.line.find(self.policy_trace_key)
+            sti = self.line.find(self.protocol_trace_key)
             if sti < 0:
-                sti = self.line.find(self.server_info_key)
+                sti = self.line.find(self.policy_trace_key)
                 if sti < 0:
-                    sti = self.line.find(self.router_ls_key)
+                    sti = self.line.find(self.server_info_key)
                     if sti < 0:
-                        raise ValueError("Log keyword/level not found in line 
%s" % (self.line))
+                        sti = self.line.find(self.router_ls_key)
+                        if sti < 0:
+                            raise ValueError("Log keyword/level not found in 
line %s" % (self.line))
+                        else:
+                            self.line = self.line[sti + 
len(self.router_ls_key):]
+                            self.data.is_router_ls = True
+                            # this has no relationship to AMQP log lines
+                            return
                     else:
-                        self.line = self.line[sti + len(self.router_ls_key):]
-                        self.data.is_router_ls = True
-                        # this has no relationship to AMQP log lines
-                        return
+                        self.line = self.line[sti + len(self.server_info_key):]
+                        self.data.is_server_info = True
                 else:
-                    self.line = self.line[sti + len(self.server_info_key):]
-                    self.data.is_server_info = True
+                    self.line = self.line[sti + len(self.policy_trace_key):]
+                    self.data.is_policy_trace = True
             else:
-                self.line = self.line[sti + len(self.policy_trace_key):]
-                self.data.is_policy_trace = True
+                self.line = self.line[sti + len(self.protocol_trace_key):]
         else:
             self.line = self.line[sti + len(self.server_trace_key):]
         ste = self.line.find(']')


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to