sonatype-lift[bot] commented on code in PR #224:
URL: https://github.com/apache/skywalking-python/pull/224#discussion_r923443038
##########
skywalking/plugins/sw_rabbitmq.py:
##########
@@ -73,8 +74,32 @@ def _sw_basic_publish(this, exchange,
def _sw__on_deliver_func(__on_deliver):
+ from pika.adapters.blocking_connection import BlockingChannel
+
def _sw__on_deliver(this, method_frame, header_frame, body):
peer = f'{this.connection.params.host}:{this.connection.params.port}'
+ consumer_tag = method_frame.method.consumer_tag
+
+ # The following is a special case for one type of channel to allow any
exit spans to be linked properly to the
+ # incoming segment. Otherwise, if we create the span here the span
ends before any oser callbacks are called and
+ # so any new spans will not be linked to the incoming message.
+
+ defer_span = False
+
+ try: # future-proofing if object structure changes
+ if consumer_tag not in this._cancelled and consumer_tag in
this._consumers:
+ consumer = this._consumers[consumer_tag]
+
+ if isinstance(consumer.__self__, BlockingChannel):
+ method_frame.method._sw_peer = peer
+ defer_span = True
+
+ except Exception:
Review Comment:
*try_except_pass:* Try, Except, Pass detected.
Reply with *"**@sonatype-lift help**"* for info about LiftBot commands.
Reply with *"**@sonatype-lift ignore**"* to tell LiftBot to leave out the
above finding from this PR.
Reply with *"**@sonatype-lift ignoreall**"* to tell LiftBot to leave out all
the findings from this PR and from the status bar in Github.
When talking to LiftBot, you need to **refresh** the page to see its
response. [Click here](https://help.sonatype.com/lift/talking-to-lift) to get
to know more about LiftBot commands.
---
Was this a good recommendation?
[ [🙁 Not
relevant](https://www.sonatype.com/lift-comment-rating?comment=299585279&lift_comment_rating=1)
] - [ [😕 Won't
fix](https://www.sonatype.com/lift-comment-rating?comment=299585279&lift_comment_rating=2)
] - [ [😑 Not critical, will
fix](https://www.sonatype.com/lift-comment-rating?comment=299585279&lift_comment_rating=3)
] - [ [🙂 Critical, will
fix](https://www.sonatype.com/lift-comment-rating?comment=299585279&lift_comment_rating=4)
] - [ [😊 Critical, fixing
now](https://www.sonatype.com/lift-comment-rating?comment=299585279&lift_comment_rating=5)
]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]