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..63fe8c2b45ed787a4356af1ad6a0e26f30e64a12 |
| --- /dev/null |
| +++ b/appengine/swarming/event_mon_metrics.py |
| @@ -0,0 +1,23 @@ |
| +# 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. |
|
M-A Ruel
2016/11/28 16:56:32
Is this synchronous or asynchronous? Please specif
Paweł Hajdan Jr.
2016/11/29 14:37:33
Done. Ideally we'd have an async mode available, b
M-A Ruel
2016/11/29 14:48:40
Ok then can you document what are the side effects
Paweł Hajdan Jr.
2016/11/29 15:14:17
Done. Please note this comment might get out of sy
|
| + |
| + 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) |
| + event.send() |
|
Vadim Sh.
2016/11/28 19:19:31
should we wrap this in try: except: and log errors
Paweł Hajdan Jr.
2016/11/29 14:37:33
Good point. Done. Marc-Antoine, what do you think?
|