(cobra metrics to statsd bot) send info about memory warnings

This commit is contained in:
Benjamin Sergeant
2020-06-19 17:46:59 -07:00
parent aae2402ed2
commit 78713895dd
3 changed files with 27 additions and 1 deletions

View File

@ -33,6 +33,24 @@ namespace
namespace ix
{
bool processMemoryWarningsMetricsEvent(const Json::Value& msg,
StatsdClient& statsdClient)
{
auto startTime = msg["device"]["start_time"].asUInt64();
auto timestamp = msg["timestamp"].asUInt64();
auto game = msg["device"]["game"].asString();
std::stringstream ss;
ss << msg["id"].asString() << "."
<< game;
std::string id = ss.str();
statsdClient.timing(id, (timestamp - startTime) / 1000);
return true;
}
bool processNetRequestMetricsEvent(const Json::Value& msg,
StatsdClient& statsdClient)
{
@ -216,6 +234,10 @@ namespace ix
{
success = processNetRequestMetricsEvent(msg, statsdClient);
}
else if (msg["id"].asString() == "engine_memory_warning_id")
{
success = processMemoryWarningsMetricsEvent(msg, statsdClient);
}
if (success) sentCount++;
});