| 427 | } |
| 428 | |
| 429 | void ImpalaHttpHandler::QueryMemoryHandler(const Webserver::WebRequest& req, |
| 430 | Document* document) { |
| 431 | TUniqueId unique_id; |
| 432 | Status parse_status = ParseIdFromRequest(req, &unique_id, "query_id"); |
| 433 | if (!parse_status.ok()) { |
| 434 | Value error(parse_status.GetDetail(), document->GetAllocator()); |
| 435 | document->AddMember("error", error, document->GetAllocator()); |
| 436 | return; |
| 437 | } |
| 438 | QueryState::ScopedRef qs(unique_id); |
| 439 | string mem_usage_text; |
| 440 | // Only queries that have started execution have a MemTracker to get usage from. |
| 441 | if (qs.get() != nullptr) { |
| 442 | mem_usage_text = qs->query_mem_tracker()->LogUsage(MemTracker::UNLIMITED_DEPTH); |
| 443 | } else { |
| 444 | mem_usage_text = "The query has either finished or has not started execution yet, " |
| 445 | "current memory consumption is not available."; |
| 446 | } |
| 447 | |
| 448 | Value mem_usage(mem_usage_text, document->GetAllocator()); |
| 449 | document->AddMember("mem_usage", mem_usage, document->GetAllocator()); |
| 450 | const auto& args = req.parsed_args; |
| 451 | Value query_id(args.find("query_id")->second, document->GetAllocator()); |
| 452 | document->AddMember("query_id", query_id, document->GetAllocator()); |
| 453 | } |
| 454 | |
| 455 | void ImpalaHttpHandler::QueryAiGenerateAnalysisHandler(const Webserver::WebRequest& req, |
| 456 | Document* document) { |
nothing calls this directly
no test coverage detected