brave-kt / brave / scopedSpanWithParent

scopedSpanWithParent

inline fun <T> Tracer.scopedSpanWithParent(name: String, parent: TraceContext, block: Tracer.() -> T): T

Kotlin friendly syntax for start/finish brave.ScopedSpan

Normally, brave needs to call start/finish like this

Tracer.startScopedSpan("DB Access", parent)
// do whatever we want to trace
span.finish()

Now, this method helps us write like this

span.use("DB Access", parent) {
  // do whatever we want to trace
}