Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Hummingbird.docc/Articles/LoggingMetricsAndTracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@ The middleware ``TracingMiddleware`` will record spans for each request made to
import OpenTelemetry
import Tracing

// Bootstrap Open Telemetry
let otel = OTel(serviceName: "example", eventLoopGroup: .singleton)
try otel.start().wait()
InstrumentationSystem.bootstrap(otel.tracer())
// Bootstrap Open Telemetry and create OTel service
var otelConfig = OTel.Configuration.default
otelConfig.serviceName = "Hummingbird"
let otel = try OTel.bootstrap(configuration: otelConfig)

// Add tracing middleware
router.middlewares.add(TracingMiddleware(recordingHeaders: ["content-type", "content-length"]))

// Include otel in Hummingbird services
let application = Application(
router: router,
services: [otel]
)
```

If you would like to find out more about tracing, or implement your own tracing backend you can find out more [here](https://swiftpackageindex.com/apple/swift-distributed-tracing/main/documentation/tracing).
Expand Down