feat: auto register tracing layer
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
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 I've been able to confirm this will be possible if you still want to take this?
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
Still happy to take this if there's no urgent deadline as I can start on this maybe in 7-14 days :)
Sounds good to me... I guess that means anyone else has about 7 days to claim this if they want it :grin:
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 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