natchez-http4s icon indicating copy to clipboard operation
natchez-http4s copied to clipboard

Move span creation to middleware

Open msosnicki opened this issue 1 year ago • 1 comments

Proposal to change the behavior of NatchezMiddleware.server.

Currently, it puts the context into existing span. The span per request is created in the EntryPointOps, which is only used for Kleisli based implementation. It means that server middleware is not working correctly with IOLocal based tracing.

The proposal is to move the span creation (+ continuation) into middleware itself, and inject RootsSpan for Kleisli based routes.

If it's accepted, I can drop in few tests that verify that both IOLocal and Kleisli Trace implementations yield the same results.

msosnicki avatar Jun 06 '23 12:06 msosnicki

:+1: for this, we've been having to write little wrapper middlewares to do the parent span options

alexcardell avatar Jan 31 '24 16:01 alexcardell