Chromium Code Reviews| 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.
|