File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
src/clusterfuzz/_internal Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1227,6 +1227,17 @@ def _emit_build_age_metric(gcs_path):
12271227 logs .error (f'Failed to emit build age metric for { gcs_path } : { e } ' )
12281228
12291229
1230+ def _emit_build_revision_metric (revision ):
1231+ """Emits a gauge metric to track the build revision."""
1232+ monitoring_metrics .JOB_BUILD_REVISION .set (
1233+ revision ,
1234+ labels = {
1235+ 'job' : os .getenv ('JOB_NAME' ),
1236+ 'platform' : environment .platform (),
1237+ 'task' : os .getenv ('TASK_NAME' ),
1238+ })
1239+
1240+
12301241def _get_build_url (bucket_path : Optional [str ], revision : int ,
12311242 job_type : Optional [str ]):
12321243 """Returns the GCS url for a build, given a bucket path and revision"""
@@ -1297,6 +1308,7 @@ def setup_regular_build(revision,
12971308
12981309 if revision == latest_revision :
12991310 _emit_build_age_metric (build_url )
1311+ _emit_build_revision_metric (revision )
13001312
13011313 # build_url points to a GCP bucket, and we're only converting it to its HTTP
13021314 # endpoint so that we can use remote unzipping.
Original file line number Diff line number Diff line change 4444 ],
4545)
4646
47+ JOB_BUILD_REVISION = monitor .GaugeMetric (
48+ 'job/build_revision' ,
49+ description = ('Gauge for revision of trunk build '
50+ '(grouped by job/platform/task).' ),
51+ field_spec = [
52+ monitor .StringField ('job' ),
53+ monitor .StringField ('platform' ),
54+ monitor .StringField ('task' ),
55+ ],
56+ )
57+
4758JOB_BUILD_RETRIEVAL_TIME = monitor .CumulativeDistributionMetric (
4859 'task/build_retrieval_time' ,
4960 bucketer = monitor .GeometricBucketer (),
You can’t perform that action at this time.
0 commit comments