natchez-http4s
natchez-http4s copied to clipboard
IOLocal Tracing
The limitation with the current encoding is that its reliant on the spans. And needs the new root span for incomming requests. As well some tracing may be leveraged throughout the app. So instead we can construct it initially at the beginning of the world and then allow a "principled" modification to reset for contexts like requests etc.
If we get a FiberLocal this will be nice as this could be in the F of an app, or anything with LiftIO, but this gist displays it can be done with only an IOLocal.
IOLocal
https://gist.github.com/ChristopherDavenport/d871b8c12720fd30501c7c62efaf4167
FiberLocal
https://gist.github.com/ChristopherDavenport/66afc215d0111b2916f6eb820a3e344c