File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 1515import Tracing
1616
1717#if compiler(>=6.0)
18+ /// Instrument a function to place the entire body inside a span.
19+ ///
20+ /// This macro is equivalent to calling ``/Tracing/withSpan`` in the body, but saves an
21+ /// indentation level and duplication. It introduces a `span` variable into the
22+ /// body of the function which can be used to add attributes to the span.
23+ ///
24+ /// Parameters are passed directly to ``/Tracing/withSpan`` where applicable,
25+ /// and omitting the parameters from the macro omit them from the call, falling
26+ /// back to the default.
27+ ///
28+ /// - Parameters:
29+ /// - operationName: The name of the operation being traced. Defaults to the name of the function.
30+ /// - context: The `ServiceContext` providing information on where to start the new ``/Tracing/Span``.
31+ /// - kind: The ``/Tracing/SpanKind`` of the new ``/Tracing/Span``.
32+ /// - spanName: The name of the span variable to introduce in the function. Pass `"_"` to omit it.
1833@attached ( body)
1934public macro Traced(
2035 _ operationName: String ? = nil ,
2136 context: ServiceContext ? = nil ,
2237 ofKind kind: SpanKind ? = nil ,
23- span spanName: String ? = nil
38+ span spanName: String = " span "
2439) = #externalMacro( module: " TracingMacrosImplementation " , type: " TracedMacro " )
2540#endif
You can’t perform that action at this time.
0 commit comments