Ottomata has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392468 )

Change subject: Fix coal to use EventCapsule dt instead of timestamp
......................................................................

Fix coal to use EventCapsule dt instead of timestamp

Bug: T179625
Change-Id: Ib6c3f4a48472f16c0bdfa6ba9c2bfe1eed14ffa6
---
M modules/coal/files/coal
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/68/392468/1

diff --git a/modules/coal/files/coal b/modules/coal/files/coal
index 0ecd30c..1ea0783 100755
--- a/modules/coal/files/coal
+++ b/modules/coal/files/coal
@@ -33,6 +33,7 @@
 import os.path
 import select
 import signal
+import dateutil.parser
 
 import whisper
 import zmq
@@ -166,7 +167,17 @@
     def handle_event(self, meta):
         if meta['schema'] not in ('NavigationTiming', 'SaveTiming'):
             return
-        timestamp = meta['timestamp']
+
+        # dt is main EventCapsule timestamp field in ISO-8601
+        if 'dt' in meta:
+            timestamp = int(dateutil.parser.parse(meta['dt']).strftime("%s"))
+        # timestamp is backwards compatible int, this shouldn't be used 
anymore.
+        else if 'timestamp' in meta:
+            timestamp = meta['timestamp']
+        # else we can't find one, just use the current time.
+        else:
+            timestamp = int(time.time())
+
         event = meta['event']
         for metric in METRICS:
             value = event.get(metric)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6c3f4a48472f16c0bdfa6ba9c2bfe1eed14ffa6
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ottomata <[email protected]>

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

Reply via email to