Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 0d047bebf -> e3006aa92


DISPATCH-514 - Added disposition-related counters to the link object.


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

Branch: refs/heads/master
Commit: e3006aa92a9b418604809d703e7730b3a0f5c8f5
Parents: 0d047be
Author: Ted Ross <tr...@redhat.com>
Authored: Fri Sep 16 16:42:32 2016 -0400
Committer: Ted Ross <tr...@redhat.com>
Committed: Fri Sep 16 16:42:32 2016 -0400

----------------------------------------------------------------------
 doc/man/qdstat.8.adoc                         |  19 ++-
 python/qpid_dispatch/management/qdrouter.json |  25 +++
 src/router_core/agent_link.c                  | 182 ++++++++++++---------
 src/router_core/agent_link.h                  |   2 +-
 src/router_core/forwarder.c                   |   9 +-
 src/router_core/router_core_private.h         |   9 +-
 src/router_core/transfer.c                    |  25 ++-
 tools/qdstat                                  |  14 +-
 8 files changed, 195 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e3006aa9/doc/man/qdstat.8.adoc
----------------------------------------------------------------------
diff --git a/doc/man/qdstat.8.adoc b/doc/man/qdstat.8.adoc
index 7625ee8..bcd3fcd 100644
--- a/doc/man/qdstat.8.adoc
+++ b/doc/man/qdstat.8.adoc
@@ -111,12 +111,27 @@ The capacity, in deliveries, of the link
 undel::
 The number of undelivered messages stored on the link's FIFO
 
-unsettled::
+unsett::
 The number of unsettled deliveries being tracked by the link
 
-deliveries::
+del::
 The total number of deliveries that have transited this link
 
+presett:
+The number of pre-settled deliveries that transited this link
+
+acc:
+The number of deliveries on this link that were accepted
+
+rej:
+The number of deliveries on this link that were rejected
+
+rel:
+The number of deliveries on this link that were released
+
+mod:
+The number of deliveries on this link that were modified
+
 admin::
 The administrative status of the link
   - enabled - The link is enabled for normal operation

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e3006aa9/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json 
b/python/qpid_dispatch/management/qdrouter.json
index b46f341..004b0ee 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -1008,6 +1008,31 @@
                     "type": "integer",
                     "graph": true,
                     "description": "The total number of deliveries that have 
traversed this link."
+                },
+                "presettledCount": {
+                    "type": "integer",
+                    "graph": true,
+                    "description": "The total number of pre-settled 
deliveries."
+                },
+                "acceptedCount": {
+                    "type": "integer",
+                    "graph": true,
+                    "description": "The total number of accepted deliveries."
+                },
+                "rejectedCount": {
+                    "type": "integer",
+                    "graph": true,
+                    "description": "The total number of rejected deliveries."
+                },
+                "releasedCount": {
+                    "type": "integer",
+                    "graph": true,
+                    "description": "The total number of released deliveries."
+                },
+                "modifiedCount": {
+                    "type": "integer",
+                    "graph": true,
+                    "description": "The total number of modified deliveries."
                 }
             }
         },

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e3006aa9/src/router_core/agent_link.c
----------------------------------------------------------------------
diff --git a/src/router_core/agent_link.c b/src/router_core/agent_link.c
index 3b99326..2dcf552 100644
--- a/src/router_core/agent_link.c
+++ b/src/router_core/agent_link.c
@@ -36,6 +36,11 @@
 #define QDR_LINK_CONNECTION_ID      12
 #define QDR_LINK_ADMIN_STATE        13
 #define QDR_LINK_OPER_STATE         14
+#define QDR_LINK_PRESETTLED_COUNT   15
+#define QDR_LINK_ACCEPTED_COUNT     16
+#define QDR_LINK_REJECTED_COUNT     17
+#define QDR_LINK_RELEASED_COUNT     18
+#define QDR_LINK_MODIFIED_COUNT     19
 
 const char *qdr_link_columns[] =
     {"name",
@@ -53,6 +58,11 @@ const char *qdr_link_columns[] =
      "connectionId", // The connection id of the owner connection
      "adminStatus",
      "operStatus",
+     "presettledCount",
+     "acceptedCount",
+     "rejectedCount",
+     "releasedCount",
+     "modifiedCount",
      0};
 
 static const char *qd_link_type_name(qd_link_type_t lt)
@@ -77,96 +87,116 @@ static void qdr_agent_write_column_CT(qd_composed_field_t 
*body, int col, qdr_li
     char *text = 0;
 
     switch(col) {
-        case QDR_LINK_NAME: {
-            if (link->name)
-                qd_compose_insert_string(body, link->name);
-            else
-                qd_compose_insert_null(body);
-            break;
-        }
-
-        case QDR_LINK_IDENTITY: {
-            char id[100];
-            snprintf(id, 100, "%"PRId64, link->identity);
-            qd_compose_insert_string(body, id);
-            break;
-        }
+    case QDR_LINK_NAME: {
+        if (link->name)
+            qd_compose_insert_string(body, link->name);
+        else
+            qd_compose_insert_null(body);
+        break;
+    }
 
-        case QDR_LINK_TYPE:
-            qd_compose_insert_string(body, 
"org.apache.qpid.dispatch.router.link");
-            break;
+    case QDR_LINK_IDENTITY: {
+        char id[100];
+        snprintf(id, 100, "%"PRId64, link->identity);
+        qd_compose_insert_string(body, id);
+        break;
+    }
 
-        case QDR_LINK_LINK_NAME:
-            qd_compose_insert_string(body, link->name);
-            break;
+    case QDR_LINK_TYPE:
+        qd_compose_insert_string(body, "org.apache.qpid.dispatch.router.link");
+        break;
 
-        case QDR_LINK_LINK_TYPE:
-            qd_compose_insert_string(body, qd_link_type_name(link->link_type));
-            break;
+    case QDR_LINK_LINK_NAME:
+        qd_compose_insert_string(body, link->name);
+        break;
 
-        case QDR_LINK_LINK_DIR:
-            qd_compose_insert_string(body, link->link_direction == QD_INCOMING 
? "in" : "out");
-            break;
+    case QDR_LINK_LINK_TYPE:
+        qd_compose_insert_string(body, qd_link_type_name(link->link_type));
+        break;
 
-        case QDR_LINK_OWNING_ADDR:
-            if (link->owning_addr)
-                qd_compose_insert_string(body, address_key(link->owning_addr));
-            else
-                qd_compose_insert_null(body);
-            break;
+    case QDR_LINK_LINK_DIR:
+        qd_compose_insert_string(body, link->link_direction == QD_INCOMING ? 
"in" : "out");
+        break;
 
-        case QDR_LINK_CAPACITY:
-            qd_compose_insert_uint(body, link->capacity);
-            break;
+    case QDR_LINK_OWNING_ADDR:
+        if (link->owning_addr)
+            qd_compose_insert_string(body, address_key(link->owning_addr));
+        else
+            qd_compose_insert_null(body);
+        break;
 
-        case QDR_LINK_PEER:
-            if (link->connected_link) {
-                char id[100];
-                snprintf(id, 100, "%"PRId64, link->connected_link->identity);
-                qd_compose_insert_string(body, id);
-              } else
-                qd_compose_insert_null(body);
-            break;
+    case QDR_LINK_CAPACITY:
+        qd_compose_insert_uint(body, link->capacity);
+        break;
 
-        case QDR_LINK_UNDELIVERED_COUNT:
-            qd_compose_insert_ulong(body, DEQ_SIZE(link->undelivered));
-            break;
+    case QDR_LINK_PEER:
+        if (link->connected_link) {
+            char id[100];
+            snprintf(id, 100, "%"PRId64, link->connected_link->identity);
+            qd_compose_insert_string(body, id);
+        } else
+            qd_compose_insert_null(body);
+        break;
+
+    case QDR_LINK_UNDELIVERED_COUNT:
+        qd_compose_insert_ulong(body, DEQ_SIZE(link->undelivered));
+        break;
+
+    case QDR_LINK_UNSETTLED_COUNT:
+        qd_compose_insert_ulong(body, DEQ_SIZE(link->unsettled));
+        break;
+
+    case QDR_LINK_DELIVERY_COUNT:
+        qd_compose_insert_ulong(body, link->total_deliveries);
+        break;
+
+    case QDR_LINK_CONNECTION_ID:
+        qd_compose_insert_ulong(body, link->conn->management_id);
+        break;
+
+    case QDR_LINK_ADMIN_STATE:
+        text = link->admin_enabled ? "enabled" : "disabled";
+        qd_compose_insert_string(body, text);
+        break;
+
+    case QDR_LINK_OPER_STATE:
+        switch (link->oper_status) {
+        case QDR_LINK_OPER_UP:        text = "up";        break;
+        case QDR_LINK_OPER_DOWN:      text = "down";      break;
+        case QDR_LINK_OPER_QUIESCING: text = "quiescing"; break;
+        case QDR_LINK_OPER_IDLE:      text = "idle";      break;
+        default:
+            text = 0;
+        }
+        if (!!text)
+            qd_compose_insert_string(body, text);
+        else
+            qd_compose_insert_null(body);
+        break;
 
-        case QDR_LINK_UNSETTLED_COUNT:
-            qd_compose_insert_ulong(body, DEQ_SIZE(link->unsettled));
-            break;
+    case QDR_LINK_PRESETTLED_COUNT:
+        qd_compose_insert_ulong(body, link->presettled_deliveries);
+        break;
 
-        case QDR_LINK_DELIVERY_COUNT:
-            qd_compose_insert_ulong(body, link->total_deliveries);
-            break;
+    case QDR_LINK_ACCEPTED_COUNT:
+        qd_compose_insert_ulong(body, link->accepted_deliveries);
+        break;
 
-        case QDR_LINK_CONNECTION_ID:
-            qd_compose_insert_ulong(body, link->conn->management_id);
-            break;
+    case QDR_LINK_REJECTED_COUNT:
+        qd_compose_insert_ulong(body, link->rejected_deliveries);
+        break;
 
-        case QDR_LINK_ADMIN_STATE:
-            text = link->admin_enabled ? "enabled" : "disabled";
-            qd_compose_insert_string(body, text);
-            break;
+    case QDR_LINK_RELEASED_COUNT:
+        qd_compose_insert_ulong(body, link->released_deliveries);
+        break;
 
-        case QDR_LINK_OPER_STATE:
-            switch (link->oper_status) {
-            case QDR_LINK_OPER_UP:        text = "up";        break;
-            case QDR_LINK_OPER_DOWN:      text = "down";      break;
-            case QDR_LINK_OPER_QUIESCING: text = "quiescing"; break;
-            case QDR_LINK_OPER_IDLE:      text = "idle";      break;
-            default:
-                text = 0;
-            }
-            if (!!text)
-                qd_compose_insert_string(body, text);
-            else
-                qd_compose_insert_null(body);
-            break;
+    case QDR_LINK_MODIFIED_COUNT:
+        qd_compose_insert_ulong(body, link->modified_deliveries);
+        break;
 
-        default:
-            qd_compose_insert_null(body);
-            break;
+    default:
+        qd_compose_insert_null(body);
+        break;
     }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e3006aa9/src/router_core/agent_link.h
----------------------------------------------------------------------
diff --git a/src/router_core/agent_link.h b/src/router_core/agent_link.h
index db1f88a..743e251 100644
--- a/src/router_core/agent_link.h
+++ b/src/router_core/agent_link.h
@@ -29,7 +29,7 @@ void qdra_link_update_CT(qdr_core_t          *core,
                          qdr_query_t         *query,
                          qd_parsed_field_t   *in_body);
 
-#define QDR_LINK_COLUMN_COUNT  15
+#define QDR_LINK_COLUMN_COUNT  20
 
 const char *qdr_link_columns[QDR_LINK_COLUMN_COUNT + 1];
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e3006aa9/src/router_core/forwarder.c
----------------------------------------------------------------------
diff --git a/src/router_core/forwarder.c b/src/router_core/forwarder.c
index 1f4031b..ca1acb1 100644
--- a/src/router_core/forwarder.c
+++ b/src/router_core/forwarder.c
@@ -104,10 +104,11 @@ qdr_delivery_t *qdr_forward_new_delivery_CT(qdr_core_t 
*core, qdr_delivery_t *in
     uint64_t       *tag = (uint64_t*) dlv->tag;
 
     ZERO(dlv);
-    dlv->link    = link;
-    dlv->msg     = qd_message_copy(msg);
-    dlv->settled = !in_dlv || in_dlv->settled;
-    *tag         = core->next_tag++;
+    dlv->link       = link;
+    dlv->msg        = qd_message_copy(msg);
+    dlv->settled    = !in_dlv || in_dlv->settled;
+    dlv->presettled = dlv->settled;
+    *tag            = core->next_tag++;
     dlv->tag_length = 8;
 
     //

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e3006aa9/src/router_core/router_core_private.h
----------------------------------------------------------------------
diff --git a/src/router_core/router_core_private.h 
b/src/router_core/router_core_private.h
index 02568ce..2f55eee 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -210,6 +210,7 @@ struct qdr_delivery_t {
     qd_field_iterator_t *origin;
     uint64_t             disposition;
     bool                 settled;
+    bool                 presettled;
     qdr_delivery_where_t where;
     uint8_t              tag[32];
     int                  tag_length;
@@ -272,7 +273,13 @@ struct qdr_link_t {
     bool                     drain_mode;
     bool                     drain_mode_changed;
     int                      credit_to_core; ///< Number of the available 
credits incrementally given to the core
-    uint64_t                 total_deliveries;
+
+    uint64_t total_deliveries;
+    uint64_t presettled_deliveries;
+    uint64_t accepted_deliveries;
+    uint64_t rejected_deliveries;
+    uint64_t released_deliveries;
+    uint64_t modified_deliveries;
 };
 
 ALLOC_DECLARE(qdr_link_t);

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e3006aa9/src/router_core/transfer.c
----------------------------------------------------------------------
diff --git a/src/router_core/transfer.c b/src/router_core/transfer.c
index 9a30cdf..312b866 100644
--- a/src/router_core/transfer.c
+++ b/src/router_core/transfer.c
@@ -50,6 +50,7 @@ qdr_delivery_t *qdr_link_deliver(qdr_link_t *link, 
qd_message_t *msg, qd_field_i
     dlv->to_addr        = 0;
     dlv->origin         = ingress;
     dlv->settled        = settled;
+    dlv->presettled     = settled;
     dlv->link_exclusion = link_exclusion;
 
     action->args.connection.delivery = dlv;
@@ -72,6 +73,7 @@ qdr_delivery_t *qdr_link_deliver_to(qdr_link_t *link, 
qd_message_t *msg,
     dlv->to_addr        = addr;
     dlv->origin         = ingress;
     dlv->settled        = settled;
+    dlv->presettled     = settled;
     dlv->link_exclusion = link_exclusion;
 
     action->args.connection.delivery = dlv;
@@ -91,9 +93,10 @@ qdr_delivery_t *qdr_link_deliver_to_routed_link(qdr_link_t 
*link, qd_message_t *
 
     ZERO(dlv);
     sys_atomic_init(&dlv->ref_count, 1); // referenced by the action
-    dlv->link      = link;
-    dlv->msg       = msg;
-    dlv->settled   = settled;
+    dlv->link       = link;
+    dlv->msg        = msg;
+    dlv->settled    = settled;
+    dlv->presettled = settled;
 
     action->args.connection.delivery = dlv;
     action->args.connection.tag_length = tag_length;
@@ -260,7 +263,8 @@ void qdr_delivery_incref(qdr_delivery_t *delivery)
 
 static void qdr_delivery_decref_internal(qdr_delivery_t *delivery, bool 
lock_held)
 {
-    qdr_connection_t *conn   = delivery->link ? delivery->link->conn : 0;
+    qdr_link_t       *link   = delivery->link;
+    qdr_connection_t *conn   = link ? link->conn : 0;
     bool              delete = false;
     
     if (!!conn) {
@@ -283,6 +287,19 @@ static void qdr_delivery_decref_internal(qdr_delivery_t 
*delivery, bool lock_hel
             delivery->tracking_addr = 0;
         }
 
+        if (link) {
+            if (delivery->presettled)
+                link->presettled_deliveries++;
+            else if (delivery->disposition == PN_ACCEPTED)
+                link->accepted_deliveries++;
+            else if (delivery->disposition == PN_REJECTED)
+                link->rejected_deliveries++;
+            else if (delivery->disposition == PN_RELEASED)
+                link->released_deliveries++;
+            else if (delivery->disposition == PN_MODIFIED)
+                link->modified_deliveries++;
+        }
+
         qd_bitmask_free(delivery->link_exclusion);
         free_qdr_delivery_t(delivery);
     }

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e3006aa9/tools/qdstat
----------------------------------------------------------------------
diff --git a/tools/qdstat b/tools/qdstat
index e2f341a..55b7a37 100755
--- a/tools/qdstat
+++ b/tools/qdstat
@@ -226,8 +226,13 @@ class BusManager(Node):
         heads.append(Header("phs"))
         heads.append(Header("cap"))
         heads.append(Header("undel"))
-        heads.append(Header("unsettled"))
-        heads.append(Header("deliveries"))
+        heads.append(Header("unsett"))
+        heads.append(Header("del"))
+        heads.append(Header("presett"))
+        heads.append(Header("acc"))
+        heads.append(Header("rej"))
+        heads.append(Header("rel"))
+        heads.append(Header("mod"))
         heads.append(Header("admin"))
         heads.append(Header("oper"))
         if self.opts.verbose:
@@ -250,6 +255,11 @@ class BusManager(Node):
             row.append(link.undeliveredCount)
             row.append(link.unsettledCount)
             row.append(link.deliveryCount)
+            row.append(link.presettledCount)
+            row.append(link.acceptedCount)
+            row.append(link.rejectedCount)
+            row.append(link.releasedCount)
+            row.append(link.modifiedCount)
             row.append(link.adminStatus)
             row.append(link.operStatus)
             if self.opts.verbose:


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

Reply via email to