|
|
|
@ -8,6 +8,11 @@ import prometheus_client as pc
|
|
|
|
|
class CoronaExporter:
|
|
|
|
|
def __init__(self):
|
|
|
|
|
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):
|
|
|
|
|
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']
|
|
|
|
|
|
|
|
|
|
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):
|
|
|
|
|
pc.start_wsgi_server(9001)
|
|
|
|
|