From b43834135728a101a6159d584271b547d79e0898 Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Fri, 21 Feb 2020 20:57:40 +0300 Subject: [PATCH] [local_ads] A statistics event to track corrupted files. --- local_ads/statistics.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/local_ads/statistics.cpp b/local_ads/statistics.cpp index 7353f110bf..891957ff39 100644 --- a/local_ads/statistics.cpp +++ b/local_ads/statistics.cpp @@ -1,4 +1,5 @@ #include "local_ads/statistics.hpp" + #include "local_ads/config.hpp" #include "local_ads/file_helpers.hpp" @@ -20,14 +21,15 @@ #include "base/logging.hpp" #include "base/string_utils.hpp" -#include "3party/jansson/myjansson.hpp" +#include "private.h" #include #include #include #include -#include "private.h" +#include "3party/Alohalytics/src/alohalytics.h" +#include "3party/jansson/myjansson.hpp" namespace { @@ -486,6 +488,18 @@ void Statistics::ExtractMetadata(std::string const & fileName) ReaderSource src(reader); ReadMetadata(src, countryId, mwmVersion, baseTimestamp); } + + auto const expectedFileName = countryId + "_" + strings::to_string(mwmVersion) + kStatisticsExt; + + if (fileName != expectedFileName) + { + alohalytics::TStringMap const info = { + {"expectedFilename", expectedFileName}, + {"actualFilename", fileName}, + }; + alohalytics::LogEvent("localAdsBadFile", info); + } + MetadataKey const key = std::make_pair(countryId, mwmVersion); auto it = m_metadataCache.find(key); if (it != m_metadataCache.end())