Commit 69ce6853 by arbabnazar

OPS-1240 Datadog role erroring and causing builds to be marked failed

parent 30bac9d9
...@@ -71,27 +71,28 @@ class CallbackModule(object): ...@@ -71,27 +71,28 @@ class CallbackModule(object):
# Total time to run the complete playbook # Total time to run the complete playbook
total_seconds = sum([x[1][1] for x in self.stats.items()]) total_seconds = sum([x[1][1] for x in self.stats.items()])
# send the metric to datadog # send the metric to datadog
if self.datadog_api_initialized: if self.datadog_api_initialized:
datadog_tasks_metrics = []
for name, points in results: for name, points in results:
datadog.api.Metric.send( datadog_tasks_metrics.append({'metric': 'edx.ansible.task_duration',
metric="edx.ansible.task_duration", 'date_happened': points[0],
date_happened=[0], 'points': points[1],
points=points[1], 'tags': ['task:{0}'.format(self.clean_tag_value(name)),
tags=[ 'playbook:{0}'.format(self.clean_tag_value(self.playbook_name))
"task:{0}".format(self.clean_tag_value(name)), ]
"playbook:{0}".format( }
self.clean_tag_value(self.playbook_name)) )
] try:
) datadog.api.Metric.send(datadog_tasks_metrics)
datadog.api.Metric.send( datadog.api.Metric.send(metric="edx.ansible.playbook_duration",
metric="edx.ansible.playbook_duration", date_happened=time.time(),
date_happened=time.time(), points=total_seconds,
points=total_seconds, tags=["playbook:{0}".format(self.clean_tag_value(self.playbook_name))]
tags=["playbook:{0}".format( )
self.clean_tag_value(self.playbook_name))] except Exception as ex:
) logger.error(ex.message)
# Log the time of each task # Log the time of each task
for name, elapsed in results[:10]: for name, elapsed in results[:10]:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment