Phedenskog has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/314538

Change subject: Send cpuTime metrics to statsv
......................................................................

Send cpuTime metrics to statsv

If the timeline is configured to be collected (two tests for us
right now) then we will send the cpuTime and cpuTimeDoc timings
to statsv.

Bug: T145094
Change-Id: Ia35e5d57c25bcef3507a10c42f76807a1fdc4313
---
M lib/collectMetrics.js
M lib/reporter/statsv.js
2 files changed, 13 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/performance/WebPageTest 
refs/changes/38/314538/1

diff --git a/lib/collectMetrics.js b/lib/collectMetrics.js
index ed1f044..2d2b619 100644
--- a/lib/collectMetrics.js
+++ b/lib/collectMetrics.js
@@ -21,7 +21,8 @@
         var metricsToSend = {
             timings: {},
             requests: {},
-            sizes: {}
+            sizes: {},
+            cpuTimes: {}
         };
         var namespace = argv.namespace;
 
@@ -60,10 +61,15 @@
 
                 // you need to turn on timeline collecting and use Chrome for 
this to work
                 if (argv.timeline) {
-                    console.log('Devtools cpuTimes data for %s %s' , view,
-                    
JSON.stringify(tools.sum(wptJson.data.median[view].cpuTimes), null, 1));
-                    console.log('Devtools cpuTimesDoc data for %s %s' , view,
-                    
JSON.stringify(tools.sum(wptJson.data.median[view].cpuTimesDoc), null, 1));
+                    const cpuTimes = 
tools.sum(wptJson.data.median[view].cpuTimes);
+                    for (var time of Object.keys(cpuTimes)) {
+                        metricsToSend.cpuTimes[keyStart + 'cpuTimes.' + time] 
= cpuTimes[time];
+                    }
+                    const cpuTimesDoc = 
tools.sum(wptJson.data.median[view].cpuTimesDoc);
+                    for (var time of Object.keys(cpuTimesDoc)) {
+                        metricsToSend.cpuTimes[keyStart + 'cpuTimesDoc.' + 
time] =
+                        cpuTimesDoc[time];
+                    }
                 }
 
                 if (wptJson.data.median[view].userTimes) {
diff --git a/lib/reporter/statsv.js b/lib/reporter/statsv.js
index 753f3e9..7079893 100644
--- a/lib/reporter/statsv.js
+++ b/lib/reporter/statsv.js
@@ -50,7 +50,8 @@
         // flatten the structure
         Object.keys(metrics).forEach(function(type) {
             Object.keys(metrics[type]).forEach(function(metric) {
-                flatten[metric] = metrics[type][metric] + ((type === 
'timings') ? 'ms' : 'g');
+                flatten[metric] = metrics[type][metric] +
+                ((type === 'timings' || type === 'cpuTimes') ? 'ms' : 'g');
             });
         });
 

-- 
To view, visit https://gerrit.wikimedia.org/r/314538
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia35e5d57c25bcef3507a10c42f76807a1fdc4313
Gerrit-PatchSet: 1
Gerrit-Project: performance/WebPageTest
Gerrit-Branch: master
Gerrit-Owner: Phedenskog <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to