traceContextSync<T> function

  1. @Deprecated('Will be removed in v0.19.0. Use [traceSync] instead')
  2. @experimental
T traceContextSync<T>(
  1. String name,
  2. 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 [],
})

Use traceContextSync instead of traceContext when fn is not an async function.

Implementation

@Deprecated('Will be removed in v0.19.0. Use [traceSync] instead')
@experimental
T traceContextSync<T>(
  String name,
  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 [],
}) {
  return traceSync(
    name,
    () => fn(api.Context.current),
    context: context,
    tracer: tracer,
    newRoot: newRoot,
    spanKind: spanKind,
    spanLinks: spanLinks,
  );
}