Skip to content

Commit

Permalink
Fix tornado socket == None (#227)
Browse files Browse the repository at this point in the history
* improved ignore path regex

* update test

* fix sw_psycopg2 register_type()

* fix complexity level

* fix psycopg2 register_type() second arg default

* fix rabbitmq BlockingChannel consume cb span link

* add BlockingChannel.consume() instrumentation

* fix rabbit basic_get(), Makefile missing packages

* fix again for BlockingChannel.basic_get()

* fix tornado socket == None
  • Loading branch information
tom-pytel committed Jul 25, 2022
1 parent 8ce1f68 commit 1b5542f
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions skywalking/plugins/sw_tornado.py
Expand Up @@ -75,8 +75,14 @@ async def _sw_get_response(self, *args, **kwargs):
with span:
span.layer = Layer.Http
span.component = Component.Tornado
peer = request.connection.stream.socket.getpeername()
span.peer = f'{peer[0]}:{peer[1]}'

socket = request.connection.stream.socket
if socket:
peer = socket.getpeername()
span.peer = f'{peer[0]}:{peer[1]}'
else:
peer = '<unavailable>'

span.tag(TagHttpMethod(method))
span.tag(TagHttpURL(f'{request.protocol}://{request.host}{request.path}'))
result = old_execute(self, *args, **kwargs)
Expand All @@ -103,8 +109,14 @@ def _sw_get_response(self, *args, **kwargs):
with span:
span.layer = Layer.Http
span.component = Component.Tornado
peer = request.connection.stream.socket.getpeername()
span.peer = f'{peer[0]}:{peer[1]}'

socket = request.connection.stream.socket
if socket:
peer = socket.getpeername()
span.peer = f'{peer[0]}:{peer[1]}'
else:
peer = '<unavailable>'

span.tag(TagHttpMethod(method))
span.tag(TagHttpURL(f'{request.protocol}://{request.host}{request.path}'))
result = yield from old_execute(self, *args, **kwargs)
Expand Down

0 comments on commit 1b5542f

Please sign in to comment.