add more data

main
n0emis 4 years ago
parent 7930dfa835
commit fd42b453bd
Signed by: n0emis
GPG Key ID: 00FAF748B777CF10

@ -8,6 +8,11 @@ import prometheus_client as pc
class CoronaExporter: class CoronaExporter:
def __init__(self): def __init__(self):
self.cases7_per_100k = pc.Gauge('cases7_per_100k', 'Faelle der letzten 7 Tage/100.000 EW', ['county']) self.cases7_per_100k = pc.Gauge('cases7_per_100k', 'Faelle der letzten 7 Tage/100.000 EW', ['county'])
self.cases = pc.Gauge('cases', 'Anzahl Faelle', ['county'])
self.deaths = pc.Gauge('deaths', 'Anzahl Todesfaelle', ['county'])
self.death_rate = pc.Gauge('death_rate', 'Sterberate', ['county'])
self.cases_per_population = pc.Gauge('cases_per_population', 'Betroffenenrate', ['county'])
self.cases7_bl_per_100k = pc.Gauge('cases7_bl_per_100k', 'Bundeslandweite Faelle der letzten 7 Tage/100.000 EW', ['county'])
def get_metrics(self): def get_metrics(self):
r = requests.get('https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=false&outSR=4326&f=json') r = requests.get('https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=false&outSR=4326&f=json')
@ -17,6 +22,12 @@ class CoronaExporter:
name = lk['attributes']['county'] name = lk['attributes']['county']
self.cases7_per_100k.labels(county=name).set(lk['attributes']['cases7_per_100k']) self.cases7_per_100k.labels(county=name).set(lk['attributes']['cases7_per_100k'])
self.cases.labels(county=name).set(lk['attributes']['cases'])
self.deaths.labels(county=name).set(lk['attributes']['deaths'])
self.death_rate.labels(county=name).set(lk['attributes']['death_rate'])
self.cases_per_population.labels(county=name).set(lk['attributes']['cases_per_population'])
self.cases7_bl_per_100k.labels(county=name).set(lk['attributes']['cases7_bl_per_100k'])
def run(self): def run(self):
pc.start_wsgi_server(9001) pc.start_wsgi_server(9001)

Loading…
Cancel
Save