Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/390061 )

Change subject: webperf: Record navtiming discards to Graphite, and add is_sane 
test
......................................................................


webperf: Record navtiming discards to Graphite, and add is_sane test

* Add a test case that has some of the values exceed 180s,
  to test the is_sane() filter.

  Observerved in navtiming (1):
  - The earlier values in the same event are still reported. (known bug, fixed 
in v2)
  - The ones above the treshold are ignored. (desired behaviour)
  - The ones for by_continent and by_country are not filtered by sanity. 
(previously
    unknown bug, but already fixed in v2).
  Observed in navtiming (2):
  - The event is discarded in its entirely,
    no partial reports of incomplete data. (desired behaviour)

* Add a new metric that records in Graphite when an event is discarded.
  This is similar to the logic we have already on the client-side where
  we increment the navtiming.logFailure.nonCompliant counter if the values
  were corrupted or not standards-compliant.

Change-Id: I5c4dc247f131ce9eceaef0d60e844aaf4039556b
---
M modules/webperf/files/navtiming.py
M modules/webperf/files/navtiming_fixture.yaml
2 files changed, 77 insertions(+), 1 deletion(-)

Approvals:
  Phedenskog: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Gilles: Looks good to me, but someone else must approve
  Dzahn: Looks good to me, approved



diff --git a/modules/webperf/files/navtiming.py 
b/modules/webperf/files/navtiming.py
index d055375..5e7d737 100755
--- a/modules/webperf/files/navtiming.py
+++ b/modules/webperf/files/navtiming.py
@@ -306,10 +306,24 @@
 
 
 def make_stat(*args):
+    """
+    Create a statsd packet for adding a measure to a Timing metric
+    """
     args = list(args)
     value = args.pop()
     name = '.'.join(arg.replace(' ', '_') for arg in args)
     stat = '%s:%s|ms' % (name, value)
+    return stat.encode('utf-8')
+
+
+def make_count(*args):
+    """
+    Create a statsd packet for incrementing a Counter metric
+    """
+    args = list(args)
+    value = 1
+    name = '.'.join(arg.replace(' ', '_') for arg in args)
+    stat = '%s:%s|c' % (name, value)
     return stat.encode('utf-8')
 
 
@@ -458,7 +472,9 @@
             break
 
     # If one of the metrics are over the max then skip it entirely
-    if (isSane):
+    if not isSane:
+        yield make_count('frontend.navtiming_discard', 'isSane')
+    else:
         for metric, value in metrics_nav2.items():
             prefix = 'frontend.navtiming2'
             yield make_stat(prefix, metric, site, auth, value)
diff --git a/modules/webperf/files/navtiming_fixture.yaml 
b/modules/webperf/files/navtiming_fixture.yaml
index 639ff57..b2b9f63 100644
--- a/modules/webperf/files/navtiming_fixture.yaml
+++ b/modules/webperf/files/navtiming_fixture.yaml
@@ -443,6 +443,66 @@
   - frontend.navtiming2.domInteractive.by_continent.Europe:2936|ms
   - frontend.navtiming2.domInteractive.by_country.Russia:2936|ms
 
+View with timings above threshold:
+ input: {"event": {"action": "view", "connectEnd": 0, "connectStart": 0, 
"dnsLookup": 0, "domComplete": 203077, "domInteractive": 7403, "fetchStart": 0, 
"firstPaint": 9356, "isAnon": true, "isHiDPI": false, "isHttp2": true, 
"loadEventEnd": 204085, "loadEventStart": 204083, "mediaWikiLoadComplete": 
20922, "mediaWikiVersion": "1.30.0-wmf.19", "namespaceId": 1, "originCountry": 
"FR", "originRegion": "X", "pageId": 1, "requestStart": 4484, "responseEnd": 
6286, "responseStart": 5027, "revId": 1}, "recvFrom": "example", "revision": 1, 
"schema": "NavigationTiming", "seqId": 1, "timestamp": 1, "userAgent": 
"{\"os_minor\": null, \"is_bot\": false, \"os_major\": null, \"device_family\": 
\"Other\", \"os_family\": \"Windows 10\", \"browser_minor\": \"15063\", 
\"wmf_app_version\": \"-\", \"browser_major\": \"15\", \"browser_family\": 
\"Edge\", \"is_mediawiki\": false}", "uuid": "example", "webHost": "example", 
"wiki": "example"}
+ expect:
+  # domComplete, loadEventStart and loadEventEnd are above threshold
+  - frontend.navtiming.loadEventStart.by_continent.Europe:204083|ms
+  - frontend.navtiming.loadEventStart.by_country.France:204083|ms
+  - frontend.navtiming.mediaWikiLoadComplete.desktop.anonymous:20922|ms
+  - frontend.navtiming.mediaWikiLoadComplete.desktop.overall:20922|ms
+  - frontend.navtiming.mediaWikiLoadComplete.overall:20922|ms
+  - frontend.navtiming.mediaWikiLoadComplete.by_browser.Edge.15:20922|ms
+  - frontend.navtiming.mediaWikiLoadComplete.by_browser.Edge.all:20922|ms
+  - frontend.navtiming.mediaWikiLoadComplete.by_continent.Europe:20922|ms
+  - frontend.navtiming.mediaWikiLoadComplete.by_country.France:20922|ms
+  - frontend.navtiming.dnsLookup.by_continent.Europe:0|ms
+  - frontend.navtiming.dnsLookup.by_country.France:0|ms
+  - frontend.navtiming.firstPaint.desktop.anonymous:9356|ms
+  - frontend.navtiming.firstPaint.desktop.overall:9356|ms
+  - frontend.navtiming.firstPaint.overall:9356|ms
+  - frontend.navtiming.firstPaint.by_browser.Edge.15:9356|ms
+  - frontend.navtiming.firstPaint.by_browser.Edge.all:9356|ms
+  - frontend.navtiming.firstPaint.by_continent.Europe:9356|ms
+  - frontend.navtiming.firstPaint.by_country.France:9356|ms
+  - frontend.navtiming.loadEventEnd.by_continent.Europe:204085|ms
+  - frontend.navtiming.loadEventEnd.by_country.France:204085|ms
+  - frontend.navtiming.waiting.desktop.anonymous:543|ms
+  - frontend.navtiming.waiting.desktop.overall:543|ms
+  - frontend.navtiming.waiting.overall:543|ms
+  - frontend.navtiming.waiting.by_browser.Edge.15:543|ms
+  - frontend.navtiming.waiting.by_browser.Edge.all:543|ms
+  - frontend.navtiming.waiting.by_continent.Europe:543|ms
+  - frontend.navtiming.waiting.by_country.France:543|ms
+  - frontend.navtiming.connecting.by_continent.Europe:0|ms
+  - frontend.navtiming.connecting.by_country.France:0|ms
+  - frontend.navtiming.fetchStart.by_continent.Europe:0|ms
+  - frontend.navtiming.fetchStart.by_country.France:0|ms
+  - frontend.navtiming.domComplete.by_continent.Europe:203077|ms
+  - frontend.navtiming.domComplete.by_country.France:203077|ms
+  - frontend.navtiming.receiving.desktop.anonymous:1259|ms
+  - frontend.navtiming.receiving.desktop.overall:1259|ms
+  - frontend.navtiming.receiving.overall:1259|ms
+  - frontend.navtiming.receiving.by_browser.Edge.15:1259|ms
+  - frontend.navtiming.receiving.by_browser.Edge.all:1259|ms
+  - frontend.navtiming.receiving.by_continent.Europe:1259|ms
+  - frontend.navtiming.receiving.by_country.France:1259|ms
+  - frontend.navtiming.responseStart.desktop.anonymous:5027|ms
+  - frontend.navtiming.responseStart.desktop.overall:5027|ms
+  - frontend.navtiming.responseStart.overall:5027|ms
+  - frontend.navtiming.responseStart.by_browser.Edge.15:5027|ms
+  - frontend.navtiming.responseStart.by_browser.Edge.all:5027|ms
+  - frontend.navtiming.responseStart.by_continent.Europe:5027|ms
+  - frontend.navtiming.responseStart.by_country.France:5027|ms
+  - frontend.navtiming.domInteractive.desktop.anonymous:7403|ms
+  - frontend.navtiming.domInteractive.desktop.overall:7403|ms
+  - frontend.navtiming.domInteractive.overall:7403|ms
+  - frontend.navtiming.domInteractive.by_browser.Edge.15:7403|ms
+  - frontend.navtiming.domInteractive.by_browser.Edge.all:7403|ms
+  - frontend.navtiming.domInteractive.by_continent.Europe:7403|ms
+  - frontend.navtiming.domInteractive.by_country.France:7403|ms
+  - frontend.navtiming_discard.isSane:1|c
+
 SaveTiming:
  input:
   - {"event": {"mediaWikiVersion": "1.30.0-wmf.14", "saveTiming": 2526}, 
"recvFrom": "example", "revision": 1, "schema": "SaveTiming", "seqId": 1, 
"timestamp": 1, "userAgent": "{\"os_minor\": null, \"is_bot\": false, 
\"os_major\": null, \"device_family\": \"Other\", \"os_family\": \"Windows 7\", 
\"browser_minor\": \"0\", \"wmf_app_version\": \"-\", \"browser_major\": 
\"54\", \"browser_family\": \"Firefox\", \"is_mediawiki\": false}", "uuid": 
"example", "webHost": "example", "wiki": "example"}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5c4dc247f131ce9eceaef0d60e844aaf4039556b
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Gilles <gdu...@wikimedia.org>
Gerrit-Reviewer: Phedenskog <phedens...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to