A DataDog OpenTracing Tracer written in Swift.
To install using Swift Package Manager, simply include the following line in your
Package.swift file under dependencies. Then add the dependency
"DDSwiftTracer" to any targets that require it.
.package(url: "https://github.com/kevinenax/dd-swift-trace.git", from: "0.1.0"),
Then simply add the following import statement to your source files.
Since the library uses the official OpenTracing spec, simply create an instance of the
DDSwiftTracer class and assign it as the global tracer. Then continue using the OpenTracing api.
import OpenTracing let agent = DDAgentService(agentHost: "localhost") Global.sharedTracer = DDTracer(serviceName: "myService", agentService: agent)
The library also defines a number of constants to be used as tags on span objects. Setting any of these will ensure that data ends up in DataDog and in the correct place. See
For example, the following will set the error message and status on the span when when it is serialized and transmitted to the DD Agent:
span.setTag(key: DDSpan.Tags.error, value: "Error reason goes here")