traceContext<T> function

  1. @Deprecated('Will be removed in v0.19.0. Use [trace] instead')
  2. @experimental
Future<T> traceContext<T>(
  1. String name,
  2. Future<T> fn(
    1. Context
    ), {
  3. Context? context,
  4. Tracer? tracer,
  5. bool newRoot = false,
  6. SpanKind spanKind = api.SpanKind.internal,
  7. List<SpanLink> spanLinks = const [],
})

Records a span of the given name for the given function with a given api.Tracer and marks the span as errored if an exception occurs.

Implementation

@Deprecated('Will be removed in v0.19.0. Use [trace] instead')
@experimental
Future<T> traceContext<T>(
  String name,
  Future<T> Function(api.Context) fn, {
  api.Context? context,
  api.Tracer? tracer,
  bool newRoot = false,
  api.SpanKind spanKind = api.SpanKind.internal,
  List<api.SpanLink> spanLinks = const [],
}) async {
  return trace(
    name,
    () => fn(api.Context.current),
    context: context,
    tracer: tracer,
    newRoot: newRoot,
    spanKind: spanKind,
    spanLinks: spanLinks,
  );
}