File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,14 @@ def readXML_and_publish_metrics_to_cw():
13
13
failures = testsuite .attrib ["failures" ]
14
14
tests = testsuite .attrib ["tests" ]
15
15
successes = int (tests ) - int (failures )
16
+ success_rate = (successes / int (tests ))* 100
16
17
else :
17
18
print ("f{xml_path} does not exists." )
18
19
print (os .getcwd ())
19
20
failures = 0
20
21
successes = 0
21
- tests = 23
22
+ tests = 0
23
+ success_rate = 0
22
24
23
25
timestamp = datetime .now ().strftime ("%Y-%m-%dT%H:%M:%S" )
24
26
@@ -59,6 +61,15 @@ def readXML_and_publish_metrics_to_cw():
59
61
"Value" : int (successes ),
60
62
"Unit" : "Count" ,
61
63
},
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
+ },
62
73
]
63
74
64
75
# Use the put_metric_data method to push the metric data to CloudWatch
You can’t perform that action at this time.
0 commit comments