From ca74323ee88d44dbc0a8dbe639057e6cbc86b017 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Tue, 21 Mar 2017 08:56:30 -0400
Subject: [PATCH] SL-409 - added version field = 2 to asset stats, made
 viewer-side metrics files exactly match the payload sent to simulator.

---
 indra/newview/llappviewer.cpp    | 12 +-----------
 indra/newview/lltexturefetch.cpp |  8 ++++++++
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index b138631f92c..5503313dde4 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -844,12 +844,6 @@ bool LLAppViewer::init()
     LLMachineID::init();
 	
 	{
-		// Viewer metrics initialization
-		//static LLCachedControl<bool> metrics_submode(gSavedSettings,
-		//											 "QAModeMetrics",
-		//											 false,
-		//											 "Enables QA features (logging, faster cycling) for metrics collector");
-
 		if (gSavedSettings.getBOOL("QAModeMetrics"))
 		{
 			app_metrics_qa_mode = true;
@@ -5913,11 +5907,7 @@ void LLAppViewer::metricsSend(bool enable_reporting)
 			std::string	caps_url = regionp->getCapability("ViewerMetrics");
 
             LLSD sd = gViewerAssetStats->asLLSD(true);
-            if (gSavedSettings.getBOOL("QAModeMetrics"))
-            {
-                dump_sequential_xml("metric_asset_stats",sd);
-            }
-            
+
 			// Send a report request into 'thread1' to get the rest of the data
 			// and provide some additional parameters while here.
 			LLAppViewer::sTextureFetch->commandSendMetrics(caps_url,
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 6468991c79d..887ad157ba2 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -4020,12 +4020,15 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
 	// In mStatsSD, we have a copy we own of the LLSD representation
 	// of the asset stats. Add some additional fields and ship it off.
 
+    static const S32 metrics_data_version = 2;
+    
 	bool initial_report = !reporting_started;
 	mStatsSD["session_id"] = mSessionID;
 	mStatsSD["agent_id"] = mAgentID;
 	mStatsSD["message"] = "ViewerAssetMetrics";
 	mStatsSD["sequence"] = report_sequence;
 	mStatsSD["initial"] = initial_report;
+	mStatsSD["version"] = metrics_data_version;
 	mStatsSD["break"] = static_cast<bool>(LLTextureFetch::svMetricsDataBreak);
 
     LL_INFOS(LOG_TXT) << "ViewerAssetMetrics after fields added\n" << ll_pretty_print_sd(mStatsSD) << LL_ENDL;
@@ -4041,6 +4044,11 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
 	
 	mStatsSD["truncated"] = truncate_viewer_metrics(10, mStatsSD);
 
+    if (gSavedSettings.getBOOL("QAModeMetrics"))
+    {
+        dump_sequential_xml("metric_asset_stats",mStatsSD);
+    }
+            
 	if (! mCapsURL.empty())
 	{
 		// Don't care about handle, this is a fire-and-forget operation.  
-- 
GitLab