Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cherry-pick] Push Canary Success Rate to Cloudwatch Metric #662

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion tests/canary/scripts/push_stats_to_cloudwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ def readXML_and_publish_metrics_to_cw():
failures = testsuite.attrib["failures"]
tests = testsuite.attrib["tests"]
successes = int(tests) - int(failures)
success_rate = successes/int(tests)*100
else:
failures = 0
successes = 0
tests = 1
tests = 0
success_rate = 0

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

Expand Down Expand Up @@ -58,6 +60,15 @@ def readXML_and_publish_metrics_to_cw():
"Value": int(successes),
"Unit": "Count",
},
{
"MetricName": "success_rate",
"Timestamp": timestamp,
"Dimensions": [
{"Name": "CodeBuild Project Name", "Value": project_name},
],
"Value": int(success_rate),
"Unit": "Percent",
},
]

# Use the put_metric_data method to push the metric data to CloudWatch
Expand Down