INNER CODE UNIT · Python
parse_block
braedon/prometheus-es-exporter · prometheus_es_exporter/cluster_health_parser.py:12
def parse_block(block, metric=None, labels=None):
if metric is None:
metric = []
if labels is None:
labels = OrderedDict()
metrics = []
# Green is 0, so if we add statuses of mutiple blocks together
# (e.g. all the indices) we don't need to know how many there were
# to know if things are good.
# i.e. 0 means all green, > 0 means something isn't green.
status = block['status']
if status == 'green':
status_int = 0
elif status == 'yellow':
status_int = 1
elif status == 'red':