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

[ Tracing] Add instrumentation support #1686

Merged
merged 3 commits into from
Jan 15, 2025
Merged

Conversation

Jezza
Copy link
Contributor

@Jezza Jezza commented Jan 2, 2025

When spawning futures, we lose the original span information.
This should fix that.
I tried to capture the obvious spots, but I probably didn't get them all.

Copy link

github-actions bot commented Jan 2, 2025

PR missing one of the required labels: {'enhancement', 'new feature', 'dependencies', 'bug', 'internal', 'breaking-change', 'documentation'}

@Jezza
Copy link
Contributor Author

Jezza commented Jan 2, 2025

Pipeline fails on formatting.
I'll update it tomorrow.

@gabrik gabrik added the internal Changes not included in the changelog label Jan 3, 2025
@@ -141,6 +158,9 @@ impl ZRuntime {
}
}
}

let f = tracing::Instrument::instrument(f, tracing::Span::current());
Copy link
Member

Choose a reason for hiding this comment

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

For performance reasons I'd put all these tracing calls behind a feature flag that is disabled by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

I'll add it in.

ZRUNTIME_POOL.get(self)
}

pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason behind adding the handle and spawn functions if they are not used anywhere in the Zenoh code? zenoh-runtime is an internal Zenoh crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason behind spawn was because a lot of futures were being spawned without an opportunity to add the instrumentation.
With the feature gate now, this just does nothing, but just delegate to the Handle.

handle itself was just because I would prefer the handle to be ignored.
I'd prefer if devs just spawned tasks via spawn instead of derefing to the handle, then using that.

That way we can forward the instrumentation.

I've removed it for now, but at some point I'd like to remove the Deref impl.

Jezza added 3 commits January 15, 2025 16:57
Add feature gate for instrumentation.
Remove `handle` fn.
@Mallets Mallets merged commit 220e082 into eclipse-zenoh:main Jan 15, 2025
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes not included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants