in edas-demo/script/scrape-data-from-prometheus/scrape-data-from-prometheus.py [0:0]
def __extract_prom_data(data: list, legend_key: str) -> (dict, dict):
draw_data = {}
statistic_data = {}
for d in data:
metric: dict = d["metric"]
key = metric[legend_key]
values: list = d["values"]
timestamps = [datetime.datetime.fromtimestamp(int(v[0])) for v in values]
values = [float(v[1]) for v in values]
draw_data[key] = (timestamps, values)
statistic_data[key] = get_min_max_avg(values)
return draw_data, statistic_data