Fix build time metric
This commit is contained in:
parent
6359cb31da
commit
d99c206b47
1 changed files with 6 additions and 5 deletions
|
@ -571,14 +571,15 @@ class EphemeralBuilderManager(BaseManager):
|
|||
|
||||
# Kill the ephemeral builder.
|
||||
yield From(self.kill_builder_executor(build_job.build_uuid))
|
||||
|
||||
|
||||
try:
|
||||
# log build time to prometheus
|
||||
realm_data = yield From(self._etcd_client.read(self._etcd_realm_key(build_component.builder_realm)))
|
||||
start_time = json.loads(realm_data.value)['start_time']
|
||||
metric_queue.build_time(time.time() - start_time, labelvalues=[realm_data.executor_name])
|
||||
except (KeyError, etcd.EtcdKeyError):
|
||||
logger.warning('Could not read realm key %s', build_component.builder_realm)
|
||||
parsed_realm_data = json.loads(realm_data.value)
|
||||
start_time = parsed_realm_data['start_time']
|
||||
metric_queue.build_time.Observe(time.time() - start_time, labelvalues=[parsed_realm_data.get('executor_name', 'unknown')])
|
||||
except Exception:
|
||||
logger.exception("Could not write build_time metric for realm key %s", build_component.builder_realm)
|
||||
|
||||
# Delete the build job from etcd.
|
||||
job_key = self._etcd_job_key(build_job)
|
||||
|
|
Reference in a new issue