Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 The LUCI Authors. All rights reserved. | |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 # that can be found in the LICENSE file. | |
| 4 | |
| 5 import logging | |
| 6 | |
| 7 import gae_event_mon | |
| 8 | |
| 9 | |
| 10 def initialize(): | |
| 11 gae_event_mon.initialize('swarming') | |
| 12 | |
| 13 | |
| 14 def send_task_event(task_result_summary): | |
| 15 """Sends an event_mon event about a swarming task (synchronously). | |
| 16 | |
| 17 Args: | |
| 18 task_result_summary: TaskResultSummary object. | |
| 19 """ | |
| 20 event = gae_event_mon.Event('POINT') | |
| 21 event.proto.swarming_task_event.id = task_result_summary.task_id | |
| 22 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.
| |
| 23 | |
| 24 # Isolate rest of the app from monitoring pipeline issues. They should | |
| 25 # not cause outage of swarming. | |
| 26 try: | |
| 27 event.send() | |
| 28 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
| |
| 29 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.
| |
| OLD | NEW |