(ws) cobra to sentry - created events with sentry tags based on tags present in the cobra messages
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <ixwebsocket/IXWebSocketHttpHeaders.h>
|
||||
#include <ixwebsocket/IXWebSocketVersion.h>
|
||||
#include <ixcore/utils/IXCoreLogger.h>
|
||||
|
||||
|
||||
@ -120,26 +121,6 @@ namespace ix
|
||||
{
|
||||
Json::Value payload;
|
||||
|
||||
payload["platform"] = "python";
|
||||
payload["sdk"]["name"] = "ws";
|
||||
payload["sdk"]["version"] = "1.0.0";
|
||||
payload["timestamp"] = SentryClient::getIso8601();
|
||||
|
||||
bool isNoisyTypes = msg["id"].asString() == "game_noisytypes_id";
|
||||
|
||||
std::string stackTraceFieldName = isNoisyTypes ? "traceback" : "stack";
|
||||
std::string stack(msg["data"][stackTraceFieldName].asString());
|
||||
|
||||
Json::Value exception;
|
||||
exception["stacktrace"]["frames"] = parseLuaStackTrace(stack);
|
||||
exception["value"] = isNoisyTypes ? parseExceptionName(stack) : msg["data"]["message"];
|
||||
|
||||
payload["exception"].append(exception);
|
||||
|
||||
Json::Value extra;
|
||||
extra["cobra_event"] = msg;
|
||||
extra["cobra_event"] = msg;
|
||||
|
||||
//
|
||||
// "tags": [
|
||||
// [
|
||||
@ -148,8 +129,62 @@ namespace ix
|
||||
// ],
|
||||
// ]
|
||||
//
|
||||
Json::Value tags;
|
||||
Json::Value tags(Json::arrayValue);
|
||||
|
||||
payload["platform"] = "python";
|
||||
payload["sdk"]["name"] = "ws";
|
||||
payload["sdk"]["version"] = IX_WEBSOCKET_VERSION;
|
||||
payload["timestamp"] = SentryClient::getIso8601();
|
||||
|
||||
bool isNoisyTypes = msg["id"].asString() == "game_noisytypes_id";
|
||||
|
||||
std::string stackTraceFieldName = isNoisyTypes ? "traceback" : "stack";
|
||||
std::string stack;
|
||||
std::string message;
|
||||
|
||||
if (isNoisyTypes)
|
||||
{
|
||||
stack = msg["data"][stackTraceFieldName].asString();
|
||||
message = parseExceptionName(stack);
|
||||
}
|
||||
else // logging
|
||||
{
|
||||
if (msg["data"].isMember("info"))
|
||||
{
|
||||
stack = msg["data"]["info"][stackTraceFieldName].asString();
|
||||
message = msg["data"]["info"]["message"].asString();
|
||||
|
||||
if (msg["data"].isMember("tags"))
|
||||
{
|
||||
auto members = msg["data"]["tags"].getMemberNames();
|
||||
|
||||
for (auto member : members)
|
||||
{
|
||||
Json::Value tag;
|
||||
tag.append(member);
|
||||
tag.append(msg["data"]["tags"][member]);
|
||||
tags.append(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stack = msg["data"][stackTraceFieldName].asString();
|
||||
message = msg["data"]["message"].asString();
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value exception;
|
||||
exception["stacktrace"]["frames"] = parseLuaStackTrace(stack);
|
||||
exception["value"] = message;
|
||||
|
||||
payload["exception"].append(exception);
|
||||
|
||||
Json::Value extra;
|
||||
extra["cobra_event"] = msg;
|
||||
extra["cobra_event"] = msg;
|
||||
|
||||
// Builtin tags
|
||||
Json::Value gameTag;
|
||||
gameTag.append("game");
|
||||
gameTag.append(msg["device"]["game"]);
|
||||
|
Reference in New Issue
Block a user