tokio-rs / tracing

Application level tracing for Rust.
https://tracing.rs
MIT License
5.54k stars 727 forks source link

Write an adapter to turn tracing spans into macOS/iOS signposts #540

Open luser opened 4 years ago

luser commented 4 years ago

Feature Request

Crates

This would probably be a new subscriber implementation.

Motivation

Apple has a built-in OS facility for adding spans that show up when profiling in Instruments: signposts. https://www.swiftbysundell.com/wwdc2018/getting-started-with-signposts/ https://developer.apple.com/videos/play/wwdc2018/405/ (this is a video) API documentation is here.

Proposal

It would be great to have an adapter to turn tracing spans into signposts so that we could reuse tracing annotations to get useful profiler data.

Alternatives

It looks like pcwalton has some existing code in this area, although it seems to be using a lower-level API and I'm not sure if it's compatible with the new OS facilities: https://github.com/pcwalton/signpost .

hawkw commented 4 years ago

This would be extremely cool! I'm not very familiar with the macOS feature, though, so it might have to fall to someone who knows more about that ecosystem... :)

luser commented 4 years ago

I'm willing to give it a shot, it'll give me a good excuse to sneak tracing into our codebase at work. :smiley:

hawkw commented 4 years ago

@luser awesome, I'm happy to provide guidance on the tracing side.

davidbarsky commented 4 years ago

@luser If you're getting started with it, try out tracing-subscriber 0.2 (which are currently released as alphas). It'll make it much easier to write a subscriber (or Layer, in the "new" terminology).