Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Initializer

init(setCustomAttributes:)

Create a TracingMiddleware
init(setCustomAttributes: @escaping @Sendable (inout SpanAttributes, Request) -> Void = { _, _ in })

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.