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 15
15
import Tracing
16
16
17
17
#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.
18
33
@attached ( body)
19
34
public macro Traced(
20
35
_ operationName: String ? = nil ,
21
36
context: ServiceContext ? = nil ,
22
37
ofKind kind: SpanKind ? = nil ,
23
- span spanName: String ? = nil
38
+ span spanName: String = " span "
24
39
) = #externalMacro( module: " TracingMacrosImplementation " , type: " TracedMacro " )
25
40
#endif
You can’t perform that action at this time.
0 commit comments