summaryrefslogtreecommitdiff
path: root/spec/frontend/serverless/utils.js
blob: ba451b7d573d7c4d1051f8d08824bd787d594e7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// eslint-disable-next-line import/prefer-default-export
export const adjustMetricQuery = data => {
  const updatedMetric = data.metrics;

  const queries = data.metrics.queries.map(query => ({
    ...query,
    result: query.result.map(result => ({
      ...result,
      values: result.values.map(([timestamp, value]) => ({
        time: new Date(timestamp * 1000).toISOString(),
        value: Number(value),
      })),
    })),
  }));

  updatedMetric.queries = queries;
  return updatedMetric;
};