So here is an approach I found that was able to get correct resource timing.
https://github.com/ChristopherDavenport/natchez-http4s-otel/blob/otel2/core/src/main/scala/io/chrisdavenport/natchezhttp4sotel/ClientMiddleware.scala#L76-L87
I was wondering how I was supposed to trace for the lifetime of a resource while staying in Resource?
Client are Request[F] => Resource[F, Response[F]] so we dont want to directly use the resource in line.
I assumed I would use wrapResource on spanBuilder, but the use seems to still collapse to F rather than maintaining the resource that's necessary to preserve the live tcp connection.
Hoping that someone might have an approach to how to best preserve the resource while tracing a resource?
So here is an approach I found that was able to get correct resource timing.
https://github.com/ChristopherDavenport/natchez-http4s-otel/blob/otel2/core/src/main/scala/io/chrisdavenport/natchezhttp4sotel/ClientMiddleware.scala#L76-L87
I was wondering how I was supposed to trace for the lifetime of a resource while staying in Resource?
Client are
Request[F] => Resource[F, Response[F]]so we dont want to directly use the resource in line.I assumed I would use
wrapResourceon spanBuilder, but theuseseems to still collapse toFrather than maintaining the resource that's necessary to preserve the live tcp connection.Hoping that someone might have an approach to how to best preserve the resource while tracing a resource?