-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
27 lines (23 loc) · 1.16 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python
# -*- coding: utf-8 -*-
from datadog import initialize, api
import time
import os
import glob
import json
options = {'api_key': os.environ['API_KEY']}
initialize(**options)
root_dir = './data/prod/'
for country in os.walk(root_dir).next()[1]:
with open(root_dir + country + '/stats.json', 'r') as f:
stats = json.load(f)
total = int(stats['passed'])+int(stats['failed'])+int(stats['skipped'])
api.Metric.send(metric='qa.baseline.' + stats['environment'].lower() + '.passed', points=stats['passed'],
tags=['country:' + stats['country'].lower()])
api.Metric.send(metric='qa.baseline.' + stats['environment'].lower() + '.failed', points=stats['failed'],
tags=['country:' + stats['country'].lower()])
api.Metric.send(metric='qa.baseline.' + stats['environment'].lower() + '.pending', points=stats['skipped'],
tags=['country:' + stats['country'].lower()])
api.Metric.send(metric='qa.baseline.' + stats['environment'].lower() + '.total', points=total,
tags=['country:' + stats['country'].lower()])
time.sleep(60)