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

Preserve the tracing span in the EndpointDriver task #1616

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

flub
Copy link
Contributor

@flub flub commented Jul 26, 2023

The EndpointDriver is spawned in a task. Unless the span is copied into this task the current span is lost.

Copying the current span means any tracing calls inside the driver, from e.g. a custom AsyncUdpSocket, are preserved in the span. This makes it easy to use different parent spans for different endpoints and have log messages appear with their parent span. Otherwise these log messages are not attached to a span.


An alternative is to create a new span using tracing::info_span!("endpointdriver") instead of copying the current span. This new span would also be correctly attached to the current span as a child.

The EndpointDriver is spawned in a task.  Unless the span is copied
into this task the current span is lost.

Copying the current span means any tracing calls inside the driver,
from e.g. a custom AsyncUdpSocket, are preserved in the span.  This
makes it easy to use different parent spans for different endpoints
and have log messages appear with their parent span.  Otherwise these
log messages are not attached to a span.
@flub flub force-pushed the endpoint-driver-preserve-span branch from 3a0f317 to ed096d8 Compare July 26, 2023 09:05
Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Thanks, I've wanted this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants