Skip to content

Commit

Permalink
fix report type
Browse files Browse the repository at this point in the history
  • Loading branch information
yujun777 committed Dec 21, 2023
1 parent 25e90bd commit 5016bab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
9 changes: 5 additions & 4 deletions be/src/http/action/report_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
namespace doris {

ReportAction::ReportAction(ExecEnv* exec_env, TPrivilegeHier::type hier, TPrivilegeType::type type,
const std::string& report_name)
: HttpHandlerWithAuth(exec_env, hier, type), _report_name(report_name) {}
TaskWorkerPool::TaskWorkerType report_type)
: HttpHandlerWithAuth(exec_env, hier, type), _report_type(report_type) {}

void ReportAction::handle(HttpRequest* req) {
if (StorageEngine::instance()->notify_listener(_report_name)) {
if (StorageEngine::instance()->notify_listener(_report_type)) {
HttpChannel::send_reply(req, HttpStatus::OK, Status::OK().to_json());
} else {
HttpChannel::send_reply(
req, HttpStatus::INTERNAL_SERVER_ERROR,
Status::InternalError("unknown reporter with name: " + _report_name).to_json());
Status::InternalError("unknown reporter with name: " + std::to_string(_report_type))
.to_json());
}
}

Expand Down
5 changes: 3 additions & 2 deletions be/src/http/action/report_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#pragma once

#include "agent/task_worker_pool.h"
#include "http/http_handler_with_auth.h"
#include "http/http_request.h"

Expand All @@ -27,11 +28,11 @@ namespace doris {
class ReportAction : public HttpHandlerWithAuth {
public:
ReportAction(ExecEnv* exec_env, TPrivilegeHier::type hier, TPrivilegeType::type type,
const std::string& report_name);
TaskWorkerPool::TaskWorkerType report_type);
void handle(HttpRequest* req) override;

private:
const std::string _report_name;
const TaskWorkerPool::TaskWorkerType _report_type;
};

} // namespace doris
15 changes: 9 additions & 6 deletions be/src/service/http_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,19 @@ Status HttpService::start() {
_ev_http_server->register_handler(HttpMethod::POST, "/api/debug_point/clear",
clear_debug_points_action);

ReportAction* report_tablet_action = _pool.add(new ReportAction(
_env, TPrivilegeHier::GLOBAL, TPrivilegeType::ADMIN, "REPORT_OLAP_TABLE"));
ReportAction* report_tablet_action =
_pool.add(new ReportAction(_env, TPrivilegeHier::GLOBAL, TPrivilegeType::ADMIN,
TaskWorkerPool::TaskWorkerType::REPORT_OLAP_TABLE));
_ev_http_server->register_handler(HttpMethod::GET, "/api/report/tablet", report_tablet_action);

ReportAction* report_disk_action = _pool.add(new ReportAction(
_env, TPrivilegeHier::GLOBAL, TPrivilegeType::ADMIN, "REPORT_DISK_STATE"));
ReportAction* report_disk_action =
_pool.add(new ReportAction(_env, TPrivilegeHier::GLOBAL, TPrivilegeType::ADMIN,
TaskWorkerPool::TaskWorkerType::REPORT_DISK_STATE));
_ev_http_server->register_handler(HttpMethod::GET, "/api/report/disk", report_disk_action);

ReportAction* report_task_action = _pool.add(
new ReportAction(_env, TPrivilegeHier::GLOBAL, TPrivilegeType::ADMIN, "REPORT_TASK"));
ReportAction* report_task_action =
_pool.add(new ReportAction(_env, TPrivilegeHier::GLOBAL, TPrivilegeType::ADMIN,
TaskWorkerPool::TaskWorkerType::REPORT_TASK));
_ev_http_server->register_handler(HttpMethod::GET, "/api/report/task", report_task_action);

_ev_http_server->start();
Expand Down

0 comments on commit 5016bab

Please sign in to comment.