MCPcopy Create free account
hub / github.com/apache/arrow / WrapAsyncGenerator

Function WrapAsyncGenerator

cpp/src/arrow/util/tracing_internal.h:70–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68/// Optionally start a child span for each invocation.
69template <typename T>
70AsyncGenerator<T> WrapAsyncGenerator(AsyncGenerator<T> wrapped,
71 const std::string& span_name = "",
72 bool create_childspan = false) {
73 auto active_span = GetTracer()->GetCurrentSpan();
74 return [=]() mutable -> Future<T> {
75 auto span = active_span;
76 auto scope = GetTracer()->WithActiveSpan(active_span);
77 auto fut = wrapped();
78 if (create_childspan) {
79 span = GetTracer()->StartSpan(span_name);
80 }
81 fut.AddCallback([span](const Result<T>& result) {
82 MarkSpan(result.status(), span.get());
83 span->End();
84 });
85 return fut;
86 };
87}
88
89/// \brief Propagate the given span to each invocation of an async generator.
90template <typename T>

Callers

nothing calls this directly

Calls 6

GetTracerFunction · 0.85
MarkSpanFunction · 0.85
AddCallbackMethod · 0.45
statusMethod · 0.45
getMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected