From 78713895dd95a66681e1c7d958f0a4cd30006cd7 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Fri, 19 Jun 2020 17:46:59 -0700 Subject: [PATCH] (cobra metrics to statsd bot) send info about memory warnings --- docs/CHANGELOG.md | 4 ++++ ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp | 22 +++++++++++++++++++++ ixwebsocket/IXWebSocketVersion.h | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 537b9987..beba4275 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All changes to this project will be documented in this file. +## [9.8.0] - 2020-06-19 + +(cobra metrics to statsd bot) send info about memory warnings + ## [9.7.9] - 2020-06-18 (http client) fix deadlock when following redirects diff --git a/ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp b/ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp index 1f99bef6..711c8e67 100644 --- a/ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp +++ b/ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp @@ -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++; }); diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index 21215abf..2e7b3b56 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "9.7.9" +#define IX_WEBSOCKET_VERSION "9.8.0"