Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(interactive): Track the start_time of hqps_service and return in get_service_status #3838

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions flex/engines/http_server/actor/admin_actor.act.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ seastar::future<admin_query_result> admin_actor::start_service(
"Fail to start compiler")));
}
LOG(INFO) << "Successfully started service with graph: " << graph_name;
hqps_service.reset_start_time();
return seastar::make_ready_future<admin_query_result>(
gs::Result<seastar::sstring>("Successfully start service"));
});
Expand Down Expand Up @@ -1083,6 +1084,7 @@ seastar::future<admin_query_result> admin_actor::service_status(
} else {
res["graph"] = {};
}
res["start_time"] = hqps_service.get_start_time();
} else {
LOG(INFO) << "Query service has not been inited!";
res["status"] = "Query service has not been inited!";
Expand Down
9 changes: 9 additions & 0 deletions flex/engines/http_server/service/hqps_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void HQPSService::init(const ServiceConfig& config) {
if (config.start_compiler) {
start_compiler_subprocess();
}
start_time_.store(gs::GetCurrentTimeStamp());
}

HQPSService::~HQPSService() {
Expand Down Expand Up @@ -131,6 +132,14 @@ uint16_t HQPSService::get_query_port() const {
return 0;
}

uint64_t HQPSService::get_start_time() const {
return start_time_.load(std::memory_order_relaxed);
}

void HQPSService::reset_start_time() {
start_time_.store(gs::GetCurrentTimeStamp());
}

std::shared_ptr<gs::IGraphMetaStore> HQPSService::get_metadata_store() const {
return metadata_store_;
}
Expand Down
5 changes: 5 additions & 0 deletions flex/engines/http_server/service/hqps_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ class HQPSService {

uint16_t get_query_port() const;

uint64_t get_start_time() const;

void reset_start_time();

std::shared_ptr<gs::IGraphMetaStore> get_metadata_store() const;

gs::Result<seastar::sstring> service_status();
Expand Down Expand Up @@ -122,6 +126,7 @@ class HQPSService {
std::unique_ptr<hqps_http_handler> query_hdl_;
std::atomic<bool> running_{false};
std::atomic<bool> initialized_{false};
std::atomic<uint64_t> start_time_{0};
std::mutex mtx_;

ServiceConfig service_config_;
Expand Down
3 changes: 3 additions & 0 deletions flex/openapi/openapi_interactive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,9 @@ components:
gremlin_port:
type: integer
format: int32
start_time:
type: integer
format: int32
JobResponse:
type: object
x-body-name: job_response
Expand Down
Loading