Fix the export metrics format

Summary: Fix the format of the export. Due to unknown reason the changes done in the D14933499 was [reverted back](https://our.intern.facebook.com/intern/diff/D14933499/?src_number=80619316) on the same diff. Thus this diff fixes the format of the metrics export

Reviewed By: passy

Differential Revision: D15239653

fbshipit-source-id: b9416f89e1b0022000d6201eb08ca1f456d5ed2e
This commit is contained in:
Pritesh Nandgaonkar
2019-05-07 08:21:32 -07:00
committed by Facebook Github Bot
parent a89b732765
commit 38f3132b66
4 changed files with 29 additions and 24 deletions

View File

@@ -5,7 +5,12 @@
* @format
*/
import type {TableHighlightedRows, TableRows, TableBodyRow} from 'flipper';
import type {
TableHighlightedRows,
TableRows,
TableBodyRow,
MetricType,
} from 'flipper';
import {padStart} from 'lodash';
import {
@@ -107,9 +112,9 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
responses: {},
};
static exportMetrics = (
static metricsReducer = (
persistedState: PersistedState,
): Promise<Map<string, number | string>> => {
): Promise<MetricType> => {
const failures = Object.keys(persistedState.responses).reduce(function(
previous,
key,
@@ -117,7 +122,7 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
return previous + (persistedState.responses[key].status >= 400);
},
0);
return Promise.resolve(new Map([['NUMBER_NETWORK_FAILURES', failures]]));
return Promise.resolve({NUMBER_NETWORK_FAILURES: failures});
};
static persistedStateReducer = (