2020-12-23 19:10:25 -05:00
|
|
|
export const adjustMetricQuery = (data) => {
|
2019-04-05 22:02:39 -04:00
|
|
|
const updatedMetric = data.metrics;
|
|
|
|
|
2020-12-23 19:10:25 -05:00
|
|
|
const queries = data.metrics.queries.map((query) => ({
|
2019-04-05 22:02:39 -04:00
|
|
|
...query,
|
2020-12-23 19:10:25 -05:00
|
|
|
result: query.result.map((result) => ({
|
2019-04-05 22:02:39 -04:00
|
|
|
...result,
|
|
|
|
values: result.values.map(([timestamp, value]) => ({
|
|
|
|
time: new Date(timestamp * 1000).toISOString(),
|
|
|
|
value: Number(value),
|
|
|
|
})),
|
|
|
|
})),
|
|
|
|
}));
|
|
|
|
|
|
|
|
updatedMetric.queries = queries;
|
|
|
|
return updatedMetric;
|
|
|
|
};
|