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

+span additional withSpan to ease entering async world from non-async world #64

Merged
merged 3 commits into from
Aug 19, 2022

Conversation

ktoso
Copy link
Member

@ktoso ktoso commented Aug 19, 2022

I'm wondering if we need to offer this.

Just an idea for now, but I've hit this when calling swift code from C, where we could not have had set the task-local, so here we're "entering the async world". We could set the Baggage around the withSpan, but that means two levels of nesting and one task local set more than we actually need.

Copy link
Collaborator

@slashmo slashmo left a comment

Choose a reason for hiding this comment

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

LGTM

/// - Throws: the error the `operation` has thrown (if any)
public func withSpan<T>(
_ operationName: String,
baggage: Baggage?,
Copy link
Collaborator

Choose a reason for hiding this comment

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

To keep it more consistent with the synchronous counterpart of this withSpan, I'd make baggage a non-optional required parameter. If folks wanna start top-level let's make it obvious they do so.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, thank you!

And I'll fix the old swift issues.

@ktoso ktoso merged commit 6173049 into main Aug 19, 2022
@ktoso ktoso modified the milestones: 0.3.0, 1.0.0, 0.3.1 Aug 19, 2022
@ktoso ktoso deleted the wip-additional-withSpan branch August 22, 2022 02:39
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.

None yet

2 participants