mirror of https://github.com/ByConity/ByConity
Do not report strange exception messages into JSON report from performance-test
This commit is contained in:
parent
a999192b0a
commit
ea6053eadc
|
@ -8,6 +8,7 @@
|
|||
#include <Common/getNumberOfPhysicalCPUCores.h>
|
||||
#include <Common/getFQDNOrHostName.h>
|
||||
#include <common/getMemoryAmount.h>
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
|
||||
#include "JSONString.h"
|
||||
|
||||
|
@ -29,6 +30,10 @@ std::string getMainMetric(const PerformanceTestInfo & test_info)
|
|||
main_metric = test_info.main_metric;
|
||||
return main_metric;
|
||||
}
|
||||
bool isASCIIString(const std::string & str)
|
||||
{
|
||||
return std::all_of(str.begin(), str.end(), isASCII);
|
||||
}
|
||||
}
|
||||
|
||||
ReportBuilder::ReportBuilder(const std::string & server_version_)
|
||||
|
@ -109,7 +114,12 @@ std::string ReportBuilder::buildFullReport(
|
|||
runJSON.set("query", query);
|
||||
runJSON.set("query_index", query_index);
|
||||
if (!statistics.exception.empty())
|
||||
runJSON.set("exception", statistics.exception);
|
||||
{
|
||||
if (isASCIIString(statistics.exception))
|
||||
runJSON.set("exception", std::regex_replace(statistics.exception, QUOTE_REGEX, "\\\""));
|
||||
else
|
||||
runJSON.set("exception", "Some exception occured with non ASCII message. This may produce invalid JSON. Try reproduce locally.");
|
||||
}
|
||||
|
||||
if (test_info.exec_type == ExecutionType::Loop)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue