diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 976578e5..59e68e03 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.7.8] - 2020-06-18 + +(cobra metrics to statsd bot) send info about net requests + ## [9.7.7] - 2020-06-17 (cobra client and bots) add batch_size subscription option for retrieving multiple messages at once diff --git a/ixbots/ixbots/IXCobraMetricsToRedisBot.cpp b/ixbots/ixbots/IXCobraMetricsToRedisBot.cpp index ae5aa2bb..6f97fe56 100644 --- a/ixbots/ixbots/IXCobraMetricsToRedisBot.cpp +++ b/ixbots/ixbots/IXCobraMetricsToRedisBot.cpp @@ -115,9 +115,15 @@ namespace ix std::atomic& /*throttled*/, std::atomic& /*fatalCobraError*/, std::atomic& sentCount) -> void { - if (msg["device"].isNull() || msg["id"].isNull()) + if (msg["device"].isNull()) { - CoreLogger::info("no device or id entry, skipping event"); + CoreLogger::info("no device entry, skipping event"); + return; + } + + if (msg["id"].isNull()) + { + CoreLogger::info("no id entry, skipping event"); return; } diff --git a/ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp b/ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp index 7aa8de31..1f99bef6 100644 --- a/ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp +++ b/ixbots/ixbots/IXCobraMetricsToStatsdBot.cpp @@ -33,6 +33,42 @@ namespace namespace ix { + bool processNetRequestMetricsEvent(const Json::Value& msg, + StatsdClient& statsdClient) + { + auto durationMs = msg["data"]["duration_ms"].asUInt64(); + auto size = msg["data"]["size"].asUInt64(); + auto controller = msg["data"]["params"]["_controller"].asString(); + auto action = msg["data"]["params"]["_action"].asString(); + auto game = msg["device"]["game"].asString(); + auto status = msg["data"]["status"].asInt(); + auto osName = msg["device"]["os_name"].asString(); + + bool valid = true; + valid |= controller == "game_session" && action == "start"; + valid |= controller == "asset" && action == "manifest"; + valid |= controller == "iso_login" && action == "post_start_session"; + if (!valid) return false; + + // We only worry about successful requests + if (status != 200) return false; + + std::stringstream ss; + ss << msg["id"].asString() << "." + << "v1." + << game << "." + << osName << "." + << controller << "." + << action; + + std::string id = ss.str(); + + statsdClient.gauge(id + ".duration_ms", durationMs); + statsdClient.gauge(id + ".size", size); + + return true; + } + bool processPerfMetricsEvent(const Json::Value& msg, StatsdClient& statsdClient) { @@ -151,9 +187,15 @@ namespace ix std::atomic& /*throttled*/, std::atomic& /*fatalCobraError*/, std::atomic& sentCount) -> void { - if (msg["device"].isNull() || msg["id"].isNull()) + if (msg["device"].isNull()) { - CoreLogger::info("no device or id entry, skipping event"); + CoreLogger::info("no device entry, skipping event"); + return; + } + + if (msg["id"].isNull()) + { + CoreLogger::info("no id entry, skipping event"); return; } @@ -170,6 +212,10 @@ namespace ix success = processPerfMetricsEvent(msg, statsdClient); success |= processPerfMetricsEventSlowFrames(msg, statsdClient, deviceIdCounters, sentCount); } + else if (msg["id"].asString() == "engine_net_request_id") + { + success = processNetRequestMetricsEvent(msg, statsdClient); + } if (success) sentCount++; }); diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index e052caf5..6db51798 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "9.7.7" +#define IX_WEBSOCKET_VERSION "9.7.8"