We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, it's hard to instrument the fs2 stream properly.
Perhaps we can follow the trace4cats route and encode the stream as WriterT[Stream[F, *], Span[F], A]:
WriterT[Stream[F, *], Span[F], A]
type TracedStream[F[_]] = WriterT[Stream[F, *], Span[F], A] implicit class StreamOps[F[_], A](private val s: Stream[F, A]) { def traced(name: String)(implicit A: Applicative[F], T: Tracer[F]): TracedStream[F, A] = Stream.bracket(Tracer[F].span(name).startUnmanaged)(_.end).flatMap { span => s.evalMapChunk(a => Applicative[F].pure((span, a))) } } implicit class TracedStreamOps[F[_]](private val s: TracedStream[F, A]] { def evalMapTraced(name: String, attributes: Attributes): TracedStream[F, A] = ... }
And a bunch of overloaded syntax methods.
But maybe there are better alternatives?
The text was updated successfully, but these errors were encountered:
I don't think I ended up using it in any final implementation, but I was doing something like the following using SpanOps.Res#resource:
SpanOps.Res#resource
for (res <- Stream.resource(Tracer[F].span("name").resource)) yield someStream.translate(res.trace)
does this not work or keep the resource (span) open for too long or something?
Sorry, something went wrong.
No branches or pull requests
Currently, it's hard to instrument the fs2 stream properly.
Perhaps we can follow the trace4cats route and encode the stream as
WriterT[Stream[F, *], Span[F], A]
:And a bunch of overloaded syntax methods.
But maybe there are better alternatives?
The text was updated successfully, but these errors were encountered: