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

Unified Diff: infra_libs/event_mon/monitoring.py

Issue 2108803004: Add support for build category in BuildEvent (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressed comments Created 4 years, 5 months 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 | « infra/tools/send_monitoring_event/common.py ('k') | infra_libs/event_mon/test/monitoring_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d5e5547bfd70530c996afead11c0d34ea63d567f 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,14 @@ def get_build_event(event_type,
except (ValueError, TypeError):
pass
+ if category:
+ event.build_event.category = {
+ 'cq': BuildEvent.CATEGORY_CQ,
+ 'cq_experimental': BuildEvent.CATEGORY_CQ_EXPERIMENTAL,
+ 'git_cl_try': BuildEvent.CATEGORY_GIT_CL_TRY,
+ }.get(category.lower(), 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 +448,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 +478,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 +499,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):
« no previous file with comments | « infra/tools/send_monitoring_event/common.py ('k') | infra_libs/event_mon/test/monitoring_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698