Added placeholder for perf trace web page.

This commit is contained in:
Pedro Pinto committed 2018-10-09 20:28:56 +00:00
1 parent 53ea5ddf81
commit d62bde8158
3 files changed
+13 -8

No files matched your search

+11 -7
View File
@@ -161,7 +161,7 @@ namespace http {
_mtimer->observe((utils::TimeStamp::now() - start).microseconds() / 1000.0);
}
void return_perf_trace(connection_ptr& con,size_t max_rows) {
void return_perf_trace_data(connection_ptr& con,size_t max_rows) {
utils::TimeStamp start = utils::TimeStamp::now();
std::stringstream ss;
_trace_log.print_latest_traces(ss,max_rows);
@@ -245,6 +245,7 @@ namespace http {
boost::filesystem::path map_path_to_filesystem(const std::string& resource) {
std::string config = "/config";
std::string files = "/files";
std::string perf_trace = "/perf_trace";
if (resource.compare(0, config.size(), config) == 0) {
return _conf + resource.substr(config.size());
@@ -252,6 +253,9 @@ namespace http {
else if (resource.compare(0, files.size(), files) == 0) {
return _www + resource.substr(files.size());
}
else if (resource.compare(0, perf_trace.size(), perf_trace) == 0) {
return os::sparkd_wd() + "/data_files" + resource;
}
return web_ui_path(os::get_install_path()) / resource;
}
@@ -298,18 +302,18 @@ namespace http {
else if (boost::iequals(resource, "/metrics")) {
return_metrics(con);
}
else if (boost::iequals(resource, "/perf_trace")) {
return_perf_trace(con,1000);
else if (boost::iequals(resource, "/perf_trace_data")) {
return_perf_trace_data(con,1000);
}
else if (std::regex_match(resource, std::regex("/perf_trace/(\\d++)"))) {
std::regex rx = std::regex("/perf_trace/(\\d++)");
else if (std::regex_match(resource, std::regex("/perf_trace_data/(\\d++)"))) {
std::regex rx = std::regex("/perf_trace_data/(\\d++)");
std::smatch matches;
if (std::regex_match(resource, matches, rx)) {
auto max_rows = std::atoi(matches[1].str().c_str());
return_perf_trace(con,max_rows);
return_perf_trace_data(con,max_rows);
}
else
return_perf_trace(con,1000);
return_perf_trace_data(con,1000);
}
else if (boost::iequals(resource, "/server_info")) {
check_auth_and_return_info(con);