wu-sheng opened a new pull request, #391:
URL: https://github.com/apache/skywalking-python/pull/391
## Summary
- `@runnable` now returns a `_RunnableWrapper` object with a
`continue_tracing()` method
- `continue_tracing()` captures the snapshot on the calling (parent) thread
and returns a callable for use as `Thread` target
- Direct calls to a `@runnable`-decorated function still work as a local
span (same as `@trace`)
- No global monkey-patching of `threading.Thread`
**Before (broken for module-level):**
```python
@runnable(op='/post')
def post():
requests.post(...)
thread = Thread(target=post) # snapshot was captured at import time — None
thread.start()
```
**After:**
```python
@runnable(op='/post')
def post():
requests.post(...)
thread = Thread(target=post.continue_tracing()) # snapshot captured here
thread.start()
```
Closes https://github.com/apache/skywalking/issues/11605
## Test plan
- [x] New test `tests/plugin/web/sw_threading/` — module-level `@runnable`
with `continue_tracing()`, validates CrossThread ref
- [ ] Existing Flask test (`tests/plugin/web/sw_flask/`) — uses inline
`@runnable`, backward compatible via direct `__call__`
- [ ] CI full matrix validation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]