Skip to content

[Bug] [python] Tornado framework link cannot be traced correctly #9129

@YueLangsugar

Description

@YueLangsugar

Search before asking

  • I had searched in the issues and found no similar issues.

Apache SkyWalking Component

Python Agent (apache/skywalking-python)

What happened

I started my tornado service and sent two identical requests, but only one link?

image

What you expected to happen

There is a problem with the link

How to reproduce

There is my code. tornado==6.1

`
import asyncio
from skywalking import agent, config
from tornado.web import Application, RequestHandler, url
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop

class SwTornadoHandler(RequestHandler):

async def get(self):
    await asyncio.sleep(0.4)
    self.write({"ok": 1})

if name == 'main':
app = Application([
url(r"/api/web/test", SwTornadoHandler)
])

http_server = HTTPServer(app, xheaders=True)
http_server.bind(9696)
http_server.start(2)

config.init(
    protocol="http",
    service_instance=f"127.0.0.1:9696",
    collector_address="127.0.0.1:12800",
    service_name="python-api-service")
config.disable_plugins = ["sw_falcon", "sw_psycopg2", "sw_pyramid", "sw_sanic"]
agent.start()

IOLoop.current().start()

`

Anything else

In skywalking/trace/context.py . I modified the code and found it normal, but I don't know why.
source code:
`
def _spans_dup():
spans = __spans.get()[:]
__spans.set(spans)

    return spans`

modified code:

`
def _spans_dup():
# spans = __spans.get()[:]
# __spans.set(spans)
#
# return spans
return __spans.get()

`

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Labels

TBDTo be decided later, need more discussion or input.documentationProvide documents related issue or pull request only.pythonPython agent related

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions