Sentry: sort by response code

This commit is contained in:
Lion Kortlepel
2021-08-11 23:13:23 +02:00
committed by Lion
parent 683e13a4a0
commit 4b92532203
5 changed files with 15 additions and 8 deletions

View File

@@ -36,7 +36,8 @@ void THeartbeatThread::operator()() {
Body += "&pps=" + Application::PPS();
auto Target = "/heartbeat";
T = Http::POST(Application::GetBackendHostname(), Target, {}, Body, false);
int ResponseCode = -1;
T = Http::POST(Application::GetBackendHostname(), Target, {}, Body, false, &ResponseCode);
if (T.substr(0, 2) != "20") {
auto SentryReportError = [&](const std::string& transaction) {
@@ -47,7 +48,7 @@ void THeartbeatThread::operator()() {
{ { "response-body", T },
{ "request-body", Body } });
Sentry.SetTransaction(transaction);
Sentry.Log(SENTRY_LEVEL_ERROR, "default", "wrong backend response format");
Sentry.Log(SENTRY_LEVEL_ERROR, "default", "wrong backend response format (" + std::to_string(ResponseCode) + ")");
}
};
SentryReportError(Application::GetBackendHostname() + Target);