Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/90464
Change subject: Send VisualEditor metrics to Ganglia via StatsD
......................................................................
Send VisualEditor metrics to Ganglia via StatsD
Shoving VisualEditor metric reporting into the navtiming script is a bit gross,
but I think it'll do for now. My plan is to devise some DSL for describing how
event schema should map to metrics ("take this property and log it as a timing
metric with this key"), but until that is in place this will do.
Change-Id: I68da009ad0ed3eba718066a983acfdb5461b4947
---
M files/graphite/modules/navtiming.py
1 file changed, 31 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/64/90464/1
diff --git a/files/graphite/modules/navtiming.py
b/files/graphite/modules/navtiming.py
index 255519e..b6036e5 100644
--- a/files/graphite/modules/navtiming.py
+++ b/files/graphite/modules/navtiming.py
@@ -16,6 +16,10 @@
'rendering', 'loading', 'dnsLookup', 'pageSpeed',
'totalPageLoadTime')
+ve_schemas = {
+ 'VisualEditorDOMRetrieved': 'retrieve',
+ 'VisualEditorDOMSaved': 'save',
+}
ap = argparse.ArgumentParser(description='NavigationTiming Graphite module')
ap.add_argument('endpoint', help='URI of EventLogging endpoint')
@@ -35,11 +39,8 @@
addr = args.statsd_host, args.statsd_port
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-for meta in iter(zsock.recv_json, ''):
- if meta['revision'] not in schema_revs:
- continue
-
+def handle_nav_timing(meta):
event = meta['event']
if meta['revision'] == 5832704:
@@ -76,3 +77,29 @@
sock.sendto(stat.encode('utf-8'), addr)
stat = 'browser.%s.%s:%s|ms' % (metric, bits_cache, value)
sock.sendto(stat.encode('utf-8'), addr)
+
+
+def handle_ve(meta):
+ schema = ve_schemas[meta['schema']]
+ event = meta['event']
+ duration = int(round(event['duration']))
+ stat = 'browser.ve.dom.%s:%s|ms' % (schema, duration)
+ sock.sendto(stat.encode('utf-8'), addr)
+ if schema == 'retrieve':
+ if event.get('parsoidCachedResponse', False):
+ cache = 'cached'
+ else:
+ cache = 'uncached'
+ stat = 'browser.ve.dom.%s.%s:%s|ms' % (schema, cache, duration)
+ sock.sendto(stat.encode('utf-8'), addr)
+ stat = 'browser.ve.dom.%s.%s.count:1|c' % (cache, schema)
+ sock.sendto(stat.encode('utf-8'), addr)
+ stat = 'browser.ve.dom.%s.count:1|c' % schema
+ sock.sendto(stat.encode('utf-8'), addr)
+
+
+for meta in iter(zsock.recv_json, ''):
+ if meta['revision'] in schema_revs:
+ handle_nav_timing(meta)
+ if meta['schema'] in ve_schemas:
+ handle_ve(meta)
--
To view, visit https://gerrit.wikimedia.org/r/90464
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I68da009ad0ed3eba718066a983acfdb5461b4947
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits