[ 
https://issues.apache.org/jira/browse/DISPATCH-1854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17258360#comment-17258360
 ] 

ASF subversion and git services commented on DISPATCH-1854:
-----------------------------------------------------------

Commit 54dfd04cb854fa2bf6f4e828660160051138c070 in qpid-dispatch's branch 
refs/heads/master from Charles E. Rolke
[ https://gitbox.apache.org/repos/asf?p=qpid-dispatch.git;h=54dfd04 ]

DISPATCH-1854: Add delivery id and print in log prefix

Delivery Id is similar to connection id and link id. It will be printed
with log statements as a common prefix allowing for easier delivery
tracking.

Implementation notes:

1. Connection/Link/Delivery Id caching

This patch saves the connection id in links and the connection and link
ids in the delivery. The these copies are made once at object creation
and used as necessary. The cached copies eliminate hunting for the
values at log-statement time.

The caching is slightly complicated by initial delivery handoff in
the adaptors. That handoff is logged as the delivery's connection and
link ids are rewritten. For instance:

    TCP_ADAPTOR (debug) [C1][L1][D121] initial_delivery ownership passed to 
[C22][L68][D121]

Here a TCP_ADAPTOR egress dispatcher on [C1][L1] is passing delivery [D121]
to tcp [C22][L68].

The cache strategy may print connection and link ids after the connection
or link has disappeared. That's usually not a problem and the strategy
eliminates the defensive code required to test if the connection or link
still exists.

2. Delivery ids replace printing the address of the delivery

Delivery addresses get reused a lot and grepping for them is hard.

3. Common macros to print the connection, link, and delivery ids from a delivery

    DLV_FMT  - the format string defining conn-link-delivery log prefix
    DLV_ARGS - accessor to get log prefix values from delivery

    DLV_FMT is a quoted string similar to PRIu64 and PRIu32 and as such
    must be used outside of quotation marks in the source.

    DLV_ARGS(dlv) takes an argument which is a pointer to a
    qd_delivery_t object.

A typical usage changes code like this:

-    qd_log(core->log, QD_LOG_DEBUG, "Delivery decref_CT:  dlv:%lx rc:%"PRIu32" 
link:%"PRIu64" %s",
-          (long) dlv, ref_count - 1,  link_identity, label);
+    qd_log(core->log, QD_LOG_DEBUG, DLV_FMT" Delivery decref_CT: rc:%"PRIu32" 
%s",
+           DLV_ARGS(dlv), ref_count - 1, label);

This closes #962


> Delivery id numbers could be added for better log message comprehension
> -----------------------------------------------------------------------
>
>                 Key: DISPATCH-1854
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1854
>             Project: Qpid Dispatch
>          Issue Type: Improvement
>          Components: Protocol Adaptors, Router Node, Routing Engine
>    Affects Versions: 1.14.0
>            Reporter: Charles E. Rolke
>            Assignee: Charles E. Rolke
>            Priority: Major
>
> Deliveries could use id numbers similar to qd_server_t.next_connection_id 
> numbers.
> Then the delivery id numbers could be used in places where the qd_delivery_t 
> object addresses are printed in logs. This would eliminate the ambiguity with 
> the object addresses that get reused.
> The effort to scavenge the extra info for logs could be wrapped in 
> qd_log_enabled conditionals so that the work is done only when the log is to 
> be printed.
> Where possible log lines with delivery info could be prefixed with 
> connection, link, and delivery id numbers like *[C12][L34][D105]*
> Delivery ids could be added to transfer and settlement log lines.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to