Index: infra_libs/event_mon/monitoring.py |
diff --git a/infra_libs/event_mon/monitoring.py b/infra_libs/event_mon/monitoring.py |
index b896d588e79eb8ef93a730c4d9b3233149f495c5..98beedef79eb82cbccbb1af5594a5b762b6fee04 100644 |
--- a/infra_libs/event_mon/monitoring.py |
+++ b/infra_libs/event_mon/monitoring.py |
@@ -272,7 +272,8 @@ def get_build_event(event_type, |
goma_error=None, |
goma_crash_report_id=None, |
patch_url=None, |
- bbucket_id=None): |
+ bbucket_id=None, |
+ category=None): |
"""Compute a ChromeInfraEvent filled with a BuildEvent. |
Arguments are identical to those in send_build_event(), please refer |
@@ -345,6 +346,16 @@ def get_build_event(event_type, |
except (ValueError, TypeError): |
pass |
+ if category: |
Sergey Berezin (google)
2016/06/30 02:07:53
nit: as an option, you can write this as:
categ
Sergiy Byelozyorov
2016/07/06 08:55:30
Thanks. I've made it even shorter.
|
+ if category.lower() == 'cq': |
+ event.build_event.category = BuildEvent.CATEGORY_CQ |
+ elif category.lower() == 'cq_experimental': |
+ event.build_event.category = BuildEvent.CATEGORY_CQ_EXPERIMENTAL |
+ elif category.lower() == 'git_cl_try': |
+ event.build_event.category = BuildEvent.CATEGORY_GIT_CL_TRY |
+ else: |
+ event.build_event.category = BuildEvent.CATEGORY_UNKNOWN |
+ |
if event.build_event.step_name: |
if event_type != 'STEP': |
logging.error('step_name should be provided only for type "STEP", ' |
@@ -439,7 +450,8 @@ def send_build_event(event_type, |
goma_error=None, |
goma_crash_report_id=None, |
patch_url=None, |
- bbucket_id=None): |
+ bbucket_id=None, |
+ category=None): |
"""Send a ChromeInfraEvent filled with a BuildEvent |
Args: |
@@ -468,6 +480,7 @@ def send_build_event(event_type, |
goma_crash_report_id (string): id of goma crash report. |
patch_url (string): URL of the patch that triggered build |
bbucket_id (long): Buildbucket ID of the build. |
+ category (string): Build category, e.g. cq or git_cl_try. |
Returns: |
success (bool): False if some error happened. |
@@ -488,7 +501,8 @@ def send_build_event(event_type, |
goma_error=goma_error, |
goma_crash_report_id=goma_crash_report_id, |
patch_url=patch_url, |
- bbucket_id=bbucket_id).send() |
+ bbucket_id=bbucket_id, |
+ category=category).send() |
def send_events(events): |