shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

feat: auto register tracing layer

Open chesedo opened this issue 3 years ago • 7 comments

Currently log works transparently for rocket with shuttle, but other frameworks might need to register a middleware for logs.

We are moving over to tracing in #267. Once the move is done, we should automatically register the tracing layer for frameworks that need it by passing the tracing struct to bind and registering it correctly for each framework

chesedo avatar Jul 25 '22 07:07 chesedo

This sounds interesting (I've never done this aspect before). Would it be okay if I claim it (happy to also let it pass to another contributor whom you deem fit, too) :)

nahuakang avatar Jul 26 '22 21:07 nahuakang

@nahuakang I've been able to confirm this will be possible if you still want to take this?

chesedo avatar Aug 18 '22 12:08 chesedo

This tmp commit will be a good starting point for what is needed.

The poem hello_world example is used to prototype the changes that will be needed for codegen. These charges appear to be changing the Box<dyn log::Log> to a tracing_subsriber::Layer for registration with the tracing registry. It also confirms the implementation work for both log and tracing.

This LogItem should probably be replaced with the new Item coming from deployer. Then the logger will need to be updated to send this new Item. These lines from the deploy_layer might give you some inspiration for constructing an Item. It should be safe to ignore the tracing span/scope for now as we can take care of it in a separate PR.

I was able to test this tmp commit with the following command in the examples/poem/hello_world directory:

cargo run --manifest-path ../../../Cargo.toml --bin cargo-shuttle -- run

chesedo avatar Aug 18 '22 12:08 chesedo

Still happy to take this if there's no urgent deadline as I can start on this maybe in 7-14 days :)

nahuakang avatar Aug 18 '22 13:08 nahuakang

Sounds good to me... I guess that means anyone else has about 7 days to claim this if they want it :grin:

chesedo avatar Aug 19 '22 09:08 chesedo

If it is not too late I'd like to take this, but the tracing migration PR indicates it is still open. Is this still waiting for it?

coszio avatar Aug 29 '22 20:08 coszio

@coszio feel free to start on this one.

This one is a bit different from the open PR: this one is about changing the registration from log to tracing inside the codegen for services deployed with shuttle; the open PR is about changing shuttle itself (ie the code that deploys shuttle services) from log to tracing

chesedo avatar Aug 30 '22 05:08 chesedo