Skip to content

prefix_logs_with: Ensure the macro works correctly for futures#11095

Merged
bkchr merged 2 commits intomasterfrom
bkchr-instrument-async
Feb 18, 2026
Merged

prefix_logs_with: Ensure the macro works correctly for futures#11095
bkchr merged 2 commits intomasterfrom
bkchr-instrument-async

Conversation

@bkchr
Copy link
Copy Markdown
Member

@bkchr bkchr commented Feb 17, 2026

When setting up a tracing span in an async future, it may gets invalidated by any await point. The problem is that after continuing a future, it may runs on a different thread where the span isn't active anymore. The solution for this is to instrument the future properly.

When setting up a tracing span in an async future, it may gets invalidated by any `await` point. The problem is that
after continuing a future, it may runs on a different thread where the `span` isn't active anymore. The solution for this
is to `instrument` the future properly.
@bkchr bkchr requested a review from koute as a code owner February 17, 2026 21:27
@bkchr bkchr added the T0-node This PR/Issue is related to the topic “node”. label Feb 17, 2026
@bkchr
Copy link
Copy Markdown
Member Author

bkchr commented Feb 17, 2026

/cmd prdoc --audience node_dev --bump patch

@skunert
Copy link
Copy Markdown
Contributor

skunert commented Feb 18, 2026

@bkchr Can we replace this one here directly?

Box::pin(Instrument::instrument(

Copy link
Copy Markdown
Contributor

@lexnv lexnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This will make collators with minimal-rpc nodes happy 🙏

@bkchr bkchr added this pull request to the merge queue Feb 18, 2026
@bkchr
Copy link
Copy Markdown
Member Author

bkchr commented Feb 18, 2026

@bkchr Can we replace this one here directly?

Box::pin(Instrument::instrument(

No. This returns a future. This doesn't work there.

Merged via the queue into master with commit 00fb736 Feb 18, 2026
245 of 248 checks passed
@bkchr bkchr deleted the bkchr-instrument-async branch February 18, 2026 21:42
doc:
- audience: Node Dev
description: |-
When setting up a tracing span in an async future, it may gets invalidated by any `await` point. The problem is that after continuing a future, it may runs on a different thread where the `span` isn't active anymore. The solution for this is to `instrument` the future properly.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When setting up a tracing span in an async future, it may gets invalidated by any `await` point. The problem is that after continuing a future, it may runs on a different thread where the `span` isn't active anymore. The solution for this is to `instrument` the future properly.
When setting up a tracing span in an async future, it may get invalidated by any `await` point. The problem is that after continuing a future, it may run on a different thread where the `span` isn't active anymore. The solution for this is to `instrument` the future properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants