You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spans have lifetime, i.e. they get created, logged against, then finally they must be finished.
Currently we tackle this in Cats DSL by providing inChildSpan block, that uses Bracket to guarantee finishing the Span even in case of failures. The signature looks like this (simplified)
Since Propagation is backed by a ReaderT, we can only change the currentSpan by calling ReaderT.local(newSpan)(codeThatRunsWithTheNewSpan), the problem here that we inverted the control, codeThatRunsWithTheNewSpan is not a parameter any more.
PR #13 attempts to implement Propagation as a StateT, which would allow setting the current span to new one, however we can't set it back to the parent span once the child has been finished.
for {
parent <- tracing.getSpan()
span <- tracing.startChild(parent, operationName)
_ <- tracing.setSpan(span)
release = tracing.finish(span) *> tracing.setSpan(parent) // this doesn't work, release is not part of the monadic flow
} yield richSpan -> release
As result of this, code in the PR produce wrong spans.
outer
|_ inner1
|_ inner11
|_ inner2
|_ inner22
Every span was a child of the previous span, even if it was just adjacent to it.
Spans have lifetime, i.e. they get created, logged against, then finally they must be
finish
ed.Currently we tackle this in Cats DSL by providing
inChildSpan
block, that uses Bracket to guarantee finishing the Span even in case of failures. The signature looks like this (simplified)The aim of this task, is try to change the signature to be
So that it'd be used like this:
Please keep in mind that Span get's propagated along the context of F, creation of child Span should yield a Tree-like lineage of spans. For example:
means that spans inner1 & inner2 are adjacent, and both are children of outer.
The text was updated successfully, but these errors were encountered: