Skip to content

Commit 7626546

Browse files
authored
Merge pull request #233 from jsitu777/canary-success-rate
Push Canary Success Rate to Cloudwatch Metric
2 parents 947074e + 261636e commit 7626546

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/canary/scripts/push_stats_to_cloudwatch.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ def readXML_and_publish_metrics_to_cw():
1313
failures = testsuite.attrib["failures"]
1414
tests = testsuite.attrib["tests"]
1515
successes = int(tests) - int(failures)
16+
success_rate = (successes/int(tests))*100
1617
else:
1718
print("f{xml_path} does not exists.")
1819
print(os.getcwd())
1920
failures = 0
2021
successes = 0
21-
tests = 23
22+
tests = 0
23+
success_rate = 0
2224

2325
timestamp = datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
2426

@@ -59,6 +61,15 @@ def readXML_and_publish_metrics_to_cw():
5961
"Value": int(successes),
6062
"Unit": "Count",
6163
},
64+
{
65+
"MetricName": "success_rate",
66+
"Timestamp": timestamp,
67+
"Dimensions": [
68+
{"Name": "CodeBuild Project Name", "Value": project_name},
69+
],
70+
"Value": int(success_rate),
71+
"Unit": "Percent",
72+
},
6273
]
6374

6475
# Use the put_metric_data method to push the metric data to CloudWatch

0 commit comments

Comments
 (0)