gitlab-org--gitlab-foss/spec/frontend/serverless/utils.js

18 lines
451 B
JavaScript
Raw Normal View History

export const adjustMetricQuery = (data) => {
2019-04-05 22:02:39 -04:00
const updatedMetric = data.metrics;
const queries = data.metrics.queries.map((query) => ({
2019-04-05 22:02:39 -04:00
...query,
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;
};