joosthooz commented on a change in pull request #12609:
URL: https://github.com/apache/arrow/pull/12609#discussion_r829915767



##########
File path: cpp/src/arrow/dataset/file_parquet.cc
##########
@@ -388,10 +388,16 @@ Result<RecordBatchGenerator> 
ParquetFileFormat::ScanBatchesAsync(
     pre_filtered = true;
     if (row_groups.empty()) return 
MakeEmptyGenerator<std::shared_ptr<RecordBatch>>();
   }
+#ifdef ARROW_WITH_OPENTELEMETRY
+  auto span = ::arrow::internal::tracing::GetTracer()->GetCurrentSpan();
+#endif
   // Open the reader and pay the real IO cost.
   auto make_generator =
       [=](const std::shared_ptr<parquet::arrow::FileReader>& reader) mutable
       -> Result<RecordBatchGenerator> {
+#ifdef ARROW_WITH_OPENTELEMETRY
+    auto scope = ::arrow::internal::tracing::GetTracer()->WithActiveSpan(span);

Review comment:
       The span is automatically ended when the scope is destroyed, so that is 
what we want. I tried to create a generic wrapper that can wrap this lambda 
like we do with the AsyncGenerators etc, but I couldn't manage to figure it out 
so I dropped it for now. Do you think such an approach is possible?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to