Skip to content

Initializer

init(setCustomAttributes:)

Create a TracingMiddleware
init(setCustomAttributes: @escaping @Sendable (inout SpanAttributes, Request) -> Void)

Parameters

setCustomAttributes

Closure that allows setting custom span attributes for a particular request. A custom span attribute could be extracted from a request header, for example. This closure is called during span creation on every request, so should be lightweight.