def main(): """ Report performance metrics to DataDog. Use positional arguments as this will be kicked off with a Jenkins Post build task. See https://wiki.jenkins-ci.org/display/JENKINS/Post+build+task """ if len(sys.argv) != 3: print USAGE.format(prog=sys.argv[0]) sys.exit(1) prefix = sys.argv[1] metrics = sys.argv[2] print "PREFIX: '{}'".format(prefix) print "METRICS: '{}'".format(metrics) try: metrics_dict = json.loads(metrics) except ValueError: print "Could not parse metrics '{}' as JSON".format(metrics) sys.exit(1) print "Configuring DataDog..." dog_http_api.api_key = configure_datadog() print "Reporting metrics to DataDog..." report_metrics(prefix=prefix, metrics=metrics_dict) print "Done."
def main(): """ Find, parse, and report coverage metrics to DataDog. """ if len(sys.argv) < 3: print USAGE.format(prog=sys.argv[0]) sys.exit(1) group_json_path = sys.argv[1] report_paths = sys.argv[2:] print "Loading group definitions..." group_dict = load_group_defs(group_json_path) print "Configuring DataDog..." dog_http_api.api_key = configure_datadog() print "Parsing reports..." metrics = parse_reports(report_paths) print "Reporting metrics to DataDog..." report_metrics(metrics, group_dict) print "Done."