Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Python agent’s @runnable does not behave as expected #11605

Open
2 of 3 tasks
xlq20080808 opened this issue Nov 28, 2023 · 0 comments
Open
2 of 3 tasks

[Bug] Python agent’s @runnable does not behave as expected #11605

xlq20080808 opened this issue Nov 28, 2023 · 0 comments
Assignees
Labels
bug Something isn't working and you are sure it's a bug! plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor. python Python agent related

Comments

@xlq20080808
Copy link

xlq20080808 commented Nov 28, 2023

Search before asking

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

Apache SkyWalking Component

Python Agent (apache/skywalking-python)

What happened

python version : 3.11.4
python agent : v1.0.1
flask version: 2.3.0

demo
image

cross threads are not in one trace
image

What you expected to happen

Cross threads in one trace
As shown below
image

How to reproduce

@app.route("/")
def hello():
    thread = threading.Thread(target=post)
    thread.start()
    return "ok"

@runnable(op="/post")
def post():
    return "post ok"

Anything else

1、 when the service is started, it will try to obtain a snapshot before making method calls. The behavior is expected for an interpreted language like python.
image
But when the method is actually executed, an None snapshot will cause the trace to interrupt.
image
2、 After checking the test cases, the writing method in the picture below can behave as expected.
Each method call triggers snapshot = get_context().capture()
image
But we cannot require users to write this way

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@xlq20080808 xlq20080808 added the bug Something isn't working and you are sure it's a bug! label Nov 28, 2023
@wu-sheng wu-sheng added the python Python agent related label Nov 28, 2023
@wu-sheng wu-sheng added the plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor. label Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working and you are sure it's a bug! plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor. python Python agent related
Projects
None yet
Development

No branches or pull requests

4 participants