startActiveSpan<T> method
T
startActiveSpan<T>({
- required String name,
- required T fn(
- APISpan span
- SpanKind kind = SpanKind.internal,
- Attributes? attributes,
TODO - needs better doc. Is recordSpan superfluous?
Implementation
T startActiveSpan<T>({
required String name,
required T Function(APISpan span) fn,
SpanKind kind = SpanKind.internal,
Attributes? attributes,
}) {
final span = startSpan(name, kind: kind, attributes: attributes);
try {
// Use our own withSpan to ensure proper context propagation
return withSpan(span, () => fn(span));
} finally {
span.end();
}
}