Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: appengine/swarming/event_mon_metrics.py

Issue 2534943002: Upload basic info about completed swarming tasks to event_mon (Closed)
Patch Set: fixes Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/swarming/gae_event_mon » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/event_mon_metrics.py
diff --git a/appengine/swarming/event_mon_metrics.py b/appengine/swarming/event_mon_metrics.py
new file mode 100644
index 0000000000000000000000000000000000000000..7133507ecb7de92f8904db184bfe50ae8a057d14
--- /dev/null
+++ b/appengine/swarming/event_mon_metrics.py
@@ -0,0 +1,29 @@
+# Copyright 2016 The LUCI Authors. All rights reserved.
+# Use of this source code is governed under the Apache License, Version 2.0
+# that can be found in the LICENSE file.
+
+import logging
+
+import gae_event_mon
+
+
+def initialize():
+ gae_event_mon.initialize('swarming')
+
+
+def send_task_event(task_result_summary):
+ """Sends an event_mon event about a swarming task (synchronously).
+
+ Args:
+ task_result_summary: TaskResultSummary object.
+ """
+ event = gae_event_mon.Event('POINT')
+ event.proto.swarming_task_event.id = task_result_summary.task_id
+ logging.info('Sending event: %s', event.proto)
M-A Ruel 2016/11/29 14:48:40 I'd prefer not to log.
Paweł Hajdan Jr. 2016/11/29 15:14:17 Done.
+
+ # Isolate rest of the app from monitoring pipeline issues. They should
+ # not cause outage of swarming.
+ try:
+ event.send()
+ except Exception as e:
M-A Ruel 2016/11/29 14:48:41 Not a fan of trapping everything but I'll let it f
+ logging.error('Caught exception while sending event: %s', e)
M-A Ruel 2016/11/29 14:48:41 logging.exception() would probably be useful, then
Paweł Hajdan Jr. 2016/11/29 15:14:17 Done.
« no previous file with comments | « no previous file | appengine/swarming/gae_event_mon » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698