MCPcopy Create free account
hub / github.com/apache/impala / QueryProfileHelper

Method QueryProfileHelper

be/src/service/impala-http-handler.cc:355–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355void ImpalaHttpHandler::QueryProfileHelper(const Webserver::WebRequest& req,
356 Document* document, TRuntimeProfileFormat::type format, bool internal_profile) {
357 TUniqueId unique_id;
358 stringstream ss;
359 Status status = ParseIdFromRequest(req, &unique_id, "query_id");
360 if (!status.ok()) {
361 ss << status.GetDetail();
362 } else {
363 ImpalaServer::RuntimeProfileOutput runtime_profile;
364 if (internal_profile) {
365 Value query_id_val(PrintId(unique_id), document->GetAllocator());
366 document->AddMember("query_id", query_id_val, document->GetAllocator());
367 document->AddMember("internal_profile", true, document->GetAllocator());
368 }
369 if (format != TRuntimeProfileFormat::JSON) {
370 runtime_profile.string_output = &ss;
371 }
372 runtime_profile.json_output = document;
373 status = server_->GetRuntimeProfileOutput(unique_id, "", format, &runtime_profile);
374 if (!status.ok()) {
375 ss.str(Substitute("Could not obtain runtime profile: $0", status.GetDetail()));
376 }
377 }
378 // JSON format contents already been added inside document in GetRuntimeProfileOutput()
379 if (format != TRuntimeProfileFormat::JSON){
380 Value profile(ss.str(), document->GetAllocator());
381 document->AddMember("contents", profile, document->GetAllocator());
382 } else if (internal_profile) {
383 if (!status.ok()) {
384 Value error(ss.str(), document->GetAllocator());
385 document->AddMember("error", error, document->GetAllocator());
386 return;
387 }
388 // Add OK Status like other handlers have. These status lines could be
389 // eliminated if error was handled uniformly in all handlers.
390 Value json_status("OK");
391 document->AddMember("status", json_status, document->GetAllocator());
392 }
393}
394
395void ImpalaHttpHandler::QueryProfileEncodedHandler(const Webserver::WebRequest& req,
396 Document* document) {

Callers 1

RegisterHandlersMethod · 0.95

Calls 8

ParseIdFromRequestFunction · 0.85
PrintIdFunction · 0.85
SubstituteFunction · 0.85
GetDetailMethod · 0.80
okMethod · 0.45
AddMemberMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected