Honeycomb wrapper for OpenTelemetry on iOS and macOS.
STATUS: this library is EXPERIMENTAL. Data shapes are unstable and not safe for production. We are actively seeking feedback to ensure usability.
If you're using Xcode to manage dependencies...
- Select "Add Package Dependencies..." from the "File" menu.
- In the search field in the upper right, labeled “Search or Enter Package URL”, enter the Swift Honeycomb OpenTelemetry package url: https://github.com/honeycombio/honeycomb-opentelemetry-swift
- Add a project dependency on
Honeycomb
.
If you're using Package.swift
to manage dependencies...
- Add the Package dependency.
dependencies: [
.package(url: "https://github.com/honeycombio/honeycomb-opentelemetry-swift.git",
from: "0.0.1-alpha")
],
- Add the target dependency.
dependencies: [
.product(name: "Honeycomb", package: "honeycomb-opentelemetry-swift"),
],
To configure the SDK in your App
class:
import Honeycomb
@main
struct ExampleApp: App {
init() {
do {
let options = try HoneycombOptions.Builder()
.setAPIKey("YOUR-API-KEY")
.setServiceName("YOUR-SERVICE-NAME")
.build()
try Honeycomb.configure(options: options)
} catch {
NSException(name: NSExceptionName("HoneycombOptionsError"), reason: "\(error)").raise()
}
}
}
To manually send a span:
let tracerProvider = OpenTelemetry.instance.tracerProvider.get(
instrumentationName: "YOUR-INSTRUMENTATION-NAME",
instrumentationVersion: nil
)
let span = tracerProvider.spanBuilder(spanName: "YOUR-SPAN-NAME").startSpan()
span.end()
The following auto-instrumentation libraries are automatically included:
- MetricKit data is automatically collected.