You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2018/12/10 15:47:47 UTC

qpid-dispatch git commit: DISPATCH-1216: Show an AMQP address table

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 7ec199d46 -> c9e32ebf6


DISPATCH-1216: Show an AMQP address table

* For each link extract the source/target address
* Create a table of addresses to expose which links use that address


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/c9e32ebf
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/c9e32ebf
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/c9e32ebf

Branch: refs/heads/master
Commit: c9e32ebf6c45f47e319feba1cba8bba36ec68f98
Parents: 7ec199d
Author: Chuck Rolke <cr...@redhat.com>
Authored: Mon Dec 10 10:45:53 2018 -0500
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Mon Dec 10 10:45:53 2018 -0500

----------------------------------------------------------------------
 tools/scraper/README.md      |  8 ++++++
 tools/scraper/amqp_detail.py | 25 +++++++++++++-----
 tools/scraper/scraper.py     | 54 ++++++++++++++++++++++++++++++++++++++-
 tools/scraper/text.py        |  1 +
 4 files changed, 81 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c9e32ebf/tools/scraper/README.md
----------------------------------------------------------------------
diff --git a/tools/scraper/README.md b/tools/scraper/README.md
index afde3bf..76605d2 100644
--- a/tools/scraper/README.md
+++ b/tools/scraper/README.md
@@ -70,8 +70,16 @@ From each log file Scraper extracts:
    When you click the lozenge you don't see the data. For larger data sets the usage
    rule is to first click the lozenge to expose the data, and then click the hyperlink
    go make the data visible.
+ 
+ * For each link the first AMQP Attach is examined to discover the link's source or
+   target address. All the addresses named in all the links are aggregated into a table.
    
+   To view the link traffic first click the lozenge in the Link column to make the data
+   visible and then click the hyperlinked link name to see the data.
+ 
  * Bulk AMQP data may be shown or hidden on arbitrary per-connection selections.
+   Note: This feature is slow when a few tens of thousands of lines are being shown or
+   hidden.
  * Noteworthy AMQP frames are identified. By hand these are hard to find.
    * AMQP errors
    * Presettled transfers

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c9e32ebf/tools/scraper/amqp_detail.py
----------------------------------------------------------------------
diff --git a/tools/scraper/amqp_detail.py b/tools/scraper/amqp_detail.py
index 7f02633..136fb6b 100755
--- a/tools/scraper/amqp_detail.py
+++ b/tools/scraper/amqp_detail.py
@@ -50,11 +50,13 @@ class ConnectionDetail():
     Holds facts about sessions over the connection's lifetime
     """
 
-    def __init__(self, id):
+    def __init__(self, id, router, conn):
         # id in form 'A_15':
         #   A is the router logfile key
         #   15 is the log connection number [15]
         self.id = id
+        self.router = router
+        self.conn = conn     # from router.conn_list
 
         # seq_no number differentiates items that otherwise have same identifiers.
         # Sessions, for example: a given connection may have N distinct session
@@ -113,8 +115,9 @@ class SessionDetail:
     Holds facts about a session
     """
 
-    def __init__(self, conn_detail, conn_seq, start_time):
+    def __init__(self, id, conn_detail, conn_seq, start_time):
         # parent connection
+        self.id = id
         self.conn_detail = conn_detail
 
         # some seq number
@@ -251,7 +254,8 @@ class LinkDetail():
     This structure binds input and output links with same name
     """
 
-    def __init__(self, session_detail, session_seq, link_name, start_time):
+    def __init__(self, id, session_detail, session_seq, link_name, start_time):
+        self.id = id
         # parent session
         self.session_detail = session_detail
 
@@ -427,7 +431,7 @@ class AllDetails():
 
         for conn in self.rtr.conn_list:
             id = self.rtr.conn_id(conn)
-            self.conn_details[id] = ConnectionDetail(id)
+            self.conn_details[id] = ConnectionDetail(id, self.rtr, conn)
             conn_details = self.conn_details[id]
             conn_frames = self.rtr.conn_to_frame_map[id]
             for plf in conn_frames:
@@ -441,7 +445,8 @@ class AllDetails():
                 channel = plf.data.channel # Assume in/out channels are the same for the time being
                 sess_details = conn_details.FindSession(channel)
                 if sess_details == None:
-                    sess_details = SessionDetail(conn_details, conn_details.GetSeqNo(), plf.datetime)
+                    new_id = len(conn_details.session_list)
+                    sess_details = SessionDetail(new_id, conn_details, conn_details.GetSeqNo(), plf.datetime)
                     conn_details.session_list.append(sess_details)
                     conn_details.EndChannel(channel)
                     conn_details.chan_map[channel] = sess_details
@@ -473,7 +478,8 @@ class AllDetails():
                         sess_details.amqp_errors += 1
                     if nl is None:
                         # Creating a new link from scratch resulting in a half attached link pair
-                        nl = LinkDetail(sess_details, sess_details.GetSeqNo(), link_name, plf.datetime)
+                        new_id = len(sess_details.link_list)
+                        nl = LinkDetail(new_id, sess_details, sess_details.GetSeqNo(), link_name, plf.datetime)
                         sess_details.link_list.append(nl)
                         sess_details.link_name_to_detail_map[link_name_unambiguous] = nl
                         sess_details.link_name_conflict_map[link_name] = nl
@@ -578,6 +584,13 @@ class AllDetails():
                                     sess.unsettled += 1
                                     conn_detail.unsettled += 1
 
+    def index_addresses(self):
+        for conn in self.rtr.conn_list:
+            id = self.rtr.conn_id(conn)
+            conn_detail = self.rtr.details.conn_details[id]
+            for sess in conn_detail.session_list:
+                for link in sess.link_list:
+                    self.comn.shorteners.short_addr_names.translate(link.first_address, False, link)
 
     def show_html(self):
         for conn in self.rtr.conn_list:

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c9e32ebf/tools/scraper/scraper.py
----------------------------------------------------------------------
diff --git a/tools/scraper/scraper.py b/tools/scraper/scraper.py
index 981d3ff..45de4ac 100755
--- a/tools/scraper/scraper.py
+++ b/tools/scraper/scraper.py
@@ -227,11 +227,12 @@ def main_except(argv):
     comn.shorteners.short_data_names.sort_customers()
     comn.shorteners.short_link_names.sort_customers()
 
-    # compute settlement
+    # compute settlement and index AMQP addresses
     if not comn.args.skip_detail:
         for rtrlist in comn.routers:
             for rtr in rtrlist:
                 rtr.details.compute_settlement()
+                rtr.details.index_addresses()
 
     #
     # Start producing the output stream
@@ -442,6 +443,57 @@ def main_except(argv):
     print("</table>")
     print("<hr>")
 
+    # address overview
+    print("<a name=\"c_addresses\"></a>")
+    print("<h3>AMQP Addresses Overview</h3>")
+    # loop to print table with no expanded data
+    print("<table><tr><th>Address</th> <th>N Links</th> <th>Frames</th> <th>Unsettled</th> </tr>")
+    for i in range(0, comn.shorteners.short_addr_names.len()):
+        sname = comn.shorteners.short_addr_names.shortname(i)
+        lname = comn.shorteners.short_addr_names.longnames[i]
+        links = comn.shorteners.short_addr_names.customers(sname)
+        showthis = ("<a href=\"javascript:toggle_node('@@addr_%d')\">%s</a>" %
+                    (i, text.lozenge()))
+        visitthis = ("<a href=\"#@@addr_%d_data\">%s</a>" %
+                     (i, lname))
+        n_frames = sum(len(linkd.frame_list) for linkd in links)
+        n_unsettled = sum(linkd.unsettled for linkd in links)
+        print("<tr><td>%s %s</td> <td>%d</td> <td>%d</td> <td>%d</td></tr>" %
+              (showthis, visitthis, len(links), n_frames, n_unsettled))
+    print("</table>")
+    # loop to print expandable sub tables
+    print("<h3>AMQP Addresses Details</h3>")
+    for i in range(0, comn.shorteners.short_addr_names.len()):
+        sname = comn.shorteners.short_addr_names.shortname(i)
+        lname = comn.shorteners.short_addr_names.longnames[i]
+        links = comn.shorteners.short_addr_names.customers(sname)
+        print("<div id=\"@@addr_%d\" style=\"display:none; margin-top: 2px; margin-bottom: 2px; margin-left: 10px\">" %
+              (i))
+        print("<a name=\"@@addr_%d_data\"></a>" % (i))
+        print("<h4>Address %s - %s</h4>" % (sname, lname))
+        print("<table><tr> <th colspan=\"2\">Router</th> <th rowspan=\"2\">Dir</th> <th colspan=\"2\">Peer</th> <th rowspan=\"2\">Role</th> <th rowspan=\"2\">Link</th> <th rowspan=\"2\">Frames</th> <th rowspan=\"2\">Unsettled</th></tr>")
+        print("<tr> <th>container</th> <th>connid</th> <th>connid</th> <th>container</th></tr>")
+        for linkd in links:
+            # linkd                         # LinkDetail
+            sessd = linkd.session_detail    # SessionDetail
+            connd = sessd.conn_detail       # ConnectionDetail
+            rtr = connd.router              # Router
+            conn = connd.conn               # connection number type int
+            rid = rtr.container_name
+            id = rtr.conn_id(conn)
+            peer = rtr.conn_peer_display.get(id, "")  # peer container id
+            peerconnid = comn.conn_peers_connid.get(id, "")
+            role = "receiver" if linkd.is_receiver else "sender"
+            showall = ("<a href=\"javascript:void(0)\" onclick=\"show_node(%s_data); show_node(%s_sess_%s); show_node(%s_sess_%s_link_%s)\">%s</a>" %
+                       (id, id, sessd.conn_epoch, id, sessd.conn_epoch, linkd.session_seq, text.lozenge()))
+            visitthis = ("<a href=\"#%s_sess_%s_link_%s_data\">%s</a>" %
+                         (id, sessd.conn_epoch, linkd.session_seq, linkd.display_name))
+            print("<tr> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s %s</td> <td>%d</td> <td>%d</td> </tr>" %
+                  (rid, id, rtr.conn_dir[id], peerconnid, peer, role, showall, visitthis, len(linkd.frame_list), linkd.unsettled))
+        print("</table>")
+        print("</div>")
+    print("<hr>")
+
     # connection details
     print("<a name=\"c_conndetails\"></a>")
     print("<h3>Connection Details</h3>")

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c9e32ebf/tools/scraper/text.py
----------------------------------------------------------------------
diff --git a/tools/scraper/text.py b/tools/scraper/text.py
index da05221..8cf3094 100755
--- a/tools/scraper/text.py
+++ b/tools/scraper/text.py
@@ -118,6 +118,7 @@ def web_page_toc():
 <tr><td><a href=\"#c_logfiles\"       >Log files</a></td>             <td>Router and log file info</td></tr>
 <tr><td><a href=\"#c_rtrinstances\"   >Router Instances</a></td>      <td>Router reboot chronology</td></tr>
 <tr><td><a href=\"#c_connections\"    >Connections</a></td>           <td>Connection overview; per connection log data view control</td></tr>
+<tr><td><a href=\"#c_addresses\"      >Addresses</a></td>             <td>AMQP address usage</td></tr>
 <tr><td><a href=\"#c_connectchrono\"  >Connection Chronology</a></td> <td>Router restart and connection chronology</td></tr>
 <tr><td><a href=\"#c_conndetails\"    >Connection Details</a></td>    <td>Connection details; frames sorted by link</td></tr>
 <tr><td><a href=\"#c_noteworthy\"     >Noteworthy log lines</a></td>  <td>AMQP errors and interesting flags</td></tr>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org