gsoc-swift-tracing
gsoc-swift-tracing copied to clipboard
Provide NIO Futures TracingSupport extensions package (not sure how to call the module yet)
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.
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