debian-mirror-gitlab/spec/frontend/serverless/utils.js

18 lines
451 B
JavaScript
Raw Normal View History

2021-03-08 18:12:59 +05:30
export const adjustMetricQuery = (data) => {
2019-07-07 11:18:12 +05:30
const updatedMetric = data.metrics;
2021-03-08 18:12:59 +05:30
const queries = data.metrics.queries.map((query) => ({
2019-07-07 11:18:12 +05:30
...query,
2021-03-08 18:12:59 +05:30
result: query.result.map((result) => ({
2019-07-07 11:18:12 +05:30
...result,
values: result.values.map(([timestamp, value]) => ({
time: new Date(timestamp * 1000).toISOString(),
value: Number(value),
})),
})),
}));
updatedMetric.queries = queries;
return updatedMetric;
};