brave-kt / brave / scopedSpan

scopedSpan

inline fun <T> Tracer.scopedSpan(name: String, 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")
// do whatever we want to trace
span.finish()

Now, this method helps us write like this

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