You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/02 02:58:47 UTC

[GitHub] [doris] luozenglin commented on a diff in pull request #10533: [feature][tracing] Support query tracing to improve doris observabil…

luozenglin commented on code in PR #10533:
URL: https://github.com/apache/doris/pull/10533#discussion_r912311732


##########
be/src/runtime/plan_fragment_executor.cpp:
##########
@@ -262,30 +270,36 @@ Status PlanFragmentExecutor::open_vectorized_internal() {
         RETURN_IF_ERROR(_sink->open(runtime_state()));
     }
 
-    while (true) {
-        doris::vectorized::Block* block;
+    {
+        telemetry::SpanGuard sink_send_span_guard {};
+        while (true) {
+            doris::vectorized::Block* block;
 
-        {
-            SCOPED_CPU_TIMER(_fragment_cpu_timer);
-            RETURN_IF_ERROR(get_vectorized_internal(&block));
-        }
+            {
+                SCOPED_CPU_TIMER(_fragment_cpu_timer);
+                RETURN_IF_ERROR(get_vectorized_internal(&block));
+            }
 
-        if (block == NULL) {
-            break;
-        }
+            if (block == NULL) {
+                break;
+            }
 
-        SCOPED_TIMER(profile()->total_time_counter());
-        SCOPED_CPU_TIMER(_fragment_cpu_timer);
-        // Collect this plan and sub plan statistics, and send to parent plan.
-        if (_collect_query_statistics_with_every_batch) {
-            _collect_query_statistics();
-        }
+            SCOPED_TIMER(profile()->total_time_counter());
+            SCOPED_CPU_TIMER(_fragment_cpu_timer);
+            // Collect this plan and sub plan statistics, and send to parent plan.
+            if (_collect_query_statistics_with_every_batch) {
+                _collect_query_statistics();
+            }
 
-        auto st = _sink->send(runtime_state(), block);
-        if (st.is_end_of_file()) {
-            break;
+            auto st = _sink->send(runtime_state(), block);
+            if (UNLIKELY(!sink_send_span_guard.has_span())) {
+                sink_send_span_guard.set_span(_sink->get_send_span());

Review Comment:
   Because the _send_span in _sink is assigned at the first call to _sink->send. Maybe I can change the code to make sink_send_span_guard set span outside of the while loop to reduce this branch judgment.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org