Update the metrics to use labels instead of individual metric names

This commit is contained in:
Scott Wallace 2021-08-03 16:19:41 +01:00
parent d5a422ca10
commit f10916743c
Signed by: scott
GPG key ID: AA742FDC5AFE2A72

View file

@ -37,8 +37,9 @@ def metrics():
for generation in latest_data['data'][0]['generationmix']: for generation in latest_data['data'][0]['generationmix']:
ret_data.append( ret_data.append(
{ {
'key': f'sensor_carbon_generation_{generation["fuel"]}_perc', 'key': f'sensor_carbon_generation_perc',
'labels': { 'labels': {
'fuel': generation['fuel'],
'region': latest_data['dnoregion'], 'region': latest_data['dnoregion'],
}, },
'type': 'gauge', 'type': 'gauge',