| 108 | const TExecRequest ClientRequestState::unknown_exec_request_; |
| 109 | |
| 110 | ClientRequestState::ClientRequestState(const TQueryCtx& query_ctx, Frontend* frontend, |
| 111 | ImpalaServer* server, shared_ptr<ImpalaServer::SessionState> session, |
| 112 | QueryDriver* query_driver) |
| 113 | : query_ctx_(query_ctx), |
| 114 | last_active_time_ms_(numeric_limits<int64_t>::max()), |
| 115 | child_query_executor_(new ChildQueryExecutor), |
| 116 | session_(move(session)), |
| 117 | coord_exec_called_(false), |
| 118 | // Profile is assigned name w/ id after planning |
| 119 | profile_(RuntimeProfile::Create(&profile_pool_, "Query", false)), |
| 120 | frontend_profile_(RuntimeProfile::Create(&profile_pool_, "Frontend", false)), |
| 121 | server_profile_(RuntimeProfile::Create(&profile_pool_, "ImpalaServer", false)), |
| 122 | summary_profile_(RuntimeProfile::Create(&profile_pool_, "Summary", false)), |
| 123 | frontend_(frontend), |
| 124 | parent_server_(server), |
| 125 | start_time_us_(UnixMicros()), |
| 126 | fetch_rows_timeout_us_(MICROS_PER_MILLI * query_options().fetch_rows_timeout_ms), |
| 127 | parent_driver_(query_driver) { |
| 128 | |
| 129 | if (FLAGS_otel_trace_enabled && should_otel_trace_query( |
| 130 | query_ctx_.session.session_type, query_ctx_.client_request)) { |
| 131 | // initialize OpenTelemetry for this query |
| 132 | VLOG(2) << "Initializing OpenTelemetry trace for query " << PrintId(query_id()); |
| 133 | otel_trace_manager_ = build_otel_trace_manager(this); |
| 134 | otel_trace_manager_->StartChildSpanInit(); |
| 135 | } |
| 136 | |
| 137 | bool is_external_fe = session_type() == TSessionType::EXTERNAL_FRONTEND; |
| 138 | // "Impala Backend Timeline" was specifically chosen to exploit the lexicographical |
| 139 | // ordering defined by the underlying std::map holding the timelines displayed in |
| 140 | // the web UI. This helps ensure that "Frontend Timeline" is displayed before |
| 141 | // "Impala Backend Timeline". |
| 142 | query_events_ = summary_profile_->AddEventSequence( |
| 143 | is_external_fe ? "Impala Backend Timeline" : "Query Timeline"); |
| 144 | query_events_->Start(); |
| 145 | profile_->AddChild(summary_profile_); |
| 146 | |
| 147 | #ifndef NDEBUG |
| 148 | profile_->AddInfoString("DEBUG MODE WARNING", "Query profile created while running a " |
| 149 | "DEBUG build of Impala. Use RELEASE builds to measure query performance."); |
| 150 | #endif |
| 151 | row_materialization_timer_ = ADD_TIMER(server_profile_, "RowMaterializationTimer"); |
| 152 | num_rows_fetched_counter_ = ADD_COUNTER(server_profile_, "NumRowsFetched", TUnit::UNIT); |
| 153 | row_materialization_rate_ = |
| 154 | server_profile_->AddDerivedCounter("RowMaterializationRate", TUnit::UNIT_PER_SECOND, |
| 155 | bind<int64_t>(&RuntimeProfile::UnitsPerSecond, num_rows_fetched_counter_, |
| 156 | row_materialization_timer_)); |
| 157 | num_rows_fetched_from_cache_counter_ = |
| 158 | ADD_COUNTER(server_profile_, "NumRowsFetchedFromCache", TUnit::UNIT); |
| 159 | client_wait_timer_ = ADD_TIMER(server_profile_, "ClientFetchWaitTimer"); |
| 160 | client_wait_time_stats_ = |
| 161 | ADD_SUMMARY_STATS_TIMER(server_profile_, "ClientFetchWaitTimeStats"); |
| 162 | rpc_read_timer_ = ADD_TIMER(server_profile_, "RPCReadTimer"); |
| 163 | rpc_write_timer_ = ADD_TIMER(server_profile_, "RPCWriteTimer"); |
| 164 | rpc_count_ = ADD_COUNTER(server_profile_, "RPCCount", TUnit::UNIT); |
| 165 | get_inflight_profile_time_stats_ = |
| 166 | PROFILE_GetInFlightProfileTimeStats.Instantiate(server_profile_); |
| 167 | client_fetch_lock_wait_timer_ = |
nothing calls this directly
no test coverage detected