Sentry: add debug, remove wrong exception to sentry logging

This commit is contained in:
Lion Kortlepel 2021-08-12 01:42:22 +02:00 committed by Lion
parent ff3cbebac0
commit b33b396089

View File

@ -40,15 +40,16 @@ void THeartbeatThread::operator()() {
T = Http::POST(Application::GetBackendHostname(), Target, {}, Body, false, &ResponseCode); T = Http::POST(Application::GetBackendHostname(), Target, {}, Body, false, &ResponseCode);
if (T.substr(0, 2) != "20" || ResponseCode != 200) { if (T.substr(0, 2) != "20" || ResponseCode != 200) {
#if DEBUG
debug("got " + T + " from backend");
#endif // DEBUG
auto SentryReportError = [&](const std::string& transaction, int status) { auto SentryReportError = [&](const std::string& transaction, int status) {
if (T != "YOU_SHALL_NOT_PASS") { auto Lock = Sentry.CreateExclusiveContext();
auto Lock = Sentry.CreateExclusiveContext(); Sentry.SetContext("heartbeat",
Sentry.SetContext("heartbeat", { { "response-body", T },
{ { "response-body", T }, { "request-body", Body } });
{ "request-body", Body } }); Sentry.SetTransaction(transaction);
Sentry.SetTransaction(transaction); Sentry.Log(SentryLevel::Error, "default", "unexpected backend response (" + std::to_string(status) + ")");
Sentry.Log(SentryLevel::Error, "default", "unexpected backend response (" + std::to_string(status) + ")");
}
}; };
SentryReportError(Application::GetBackendHostname() + Target, ResponseCode); SentryReportError(Application::GetBackendHostname() + Target, ResponseCode);