gsoc-swift-tracing icon indicating copy to clipboard operation
gsoc-swift-tracing copied to clipboard

Provide NIO Futures TracingSupport extensions package (not sure how to call the module yet)

Open ktoso opened this issue 3 years ago • 1 comments

It's quite common to want to quickly wrap some code in a span for debugging, like:

let work = tracer.withSpan(name: "collecting work") { 
  // collect work
  // do things here
  return work
}

we should likely offer this build in suggar right away, and then the same would be useful for NIO futures...

let work = tracer.withEventLoopFutureSpan(name: "collecting work", context: context) { 
  return  makeSomeCall()
    .map()
    .map()
    .map() 
}

There's a number of alternative API shapes this could take... promise.traced(context) etc as well...

Let's see which APIs we should provide in an NIO "tracing helpers" package.

ktoso avatar Aug 15 '20 03:08 ktoso

This popped up previously: https://github.com/slashmo/gsoc-swift-tracing/issues/98

For reference convenience methods I have been using:

https://github.com/pokryfka/aws-xray-sdk-swift/blob/master/Sources/AWSXRayRecorder/Recorder%2BHelpers.swift https://github.com/pokryfka/aws-xray-sdk-swift/blob/master/Sources/AWSXRayRecorder/Recorder%2BNIO.swift

pokryfka avatar Aug 15 '20 06:08 pokryfka