Added telemetry for import and export

Summary: Adding telemetry for import and export feature

Reviewed By: jknoxville

Differential Revision: D14267533

fbshipit-source-id: 1a5e041d0dc8c59c325e7d80dc83f6135f479161
This commit is contained in:
Pritesh Nandgaonkar
2019-03-04 05:04:40 -08:00
committed by Facebook Github Bot
parent 7d39c33fc4
commit c098269533
4 changed files with 51 additions and 6 deletions

View File

@@ -6,7 +6,12 @@
*/
import type {FlipperPlugin, FlipperDevicePlugin} from './plugin.js';
import {exportStoreToFile, importFileToStore} from './utils/exportData.js';
import {
exportStoreToFile,
importFileToStore,
IMPORT_FLIPPER_TRACE_EVENT,
EXPORT_FLIPPER_TRACE_EVENT,
} from './utils/exportData.js';
import type {Store} from './reducers/';
import electron from 'electron';
import {GK} from 'flipper';
@@ -14,7 +19,10 @@ import {remote} from 'electron';
const {dialog} = remote;
import os from 'os';
import path from 'path';
import {
reportPlatformFailures,
tryCatchReportPlatformFailures,
} from './utils/metrics';
export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste';
export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help';
@@ -328,7 +336,10 @@ function getTemplate(
defaultPath: path.join(os.homedir(), 'FlipperExport.flipper'),
},
file => {
exportStoreToFile(file, store);
reportPlatformFailures(
exportStoreToFile(file, store),
`${EXPORT_FLIPPER_TRACE_EVENT}:UI`,
);
},
);
},
@@ -343,7 +354,9 @@ function getTemplate(
},
(files: Array<string>) => {
if (files !== undefined && files.length > 0) {
importFileToStore(files[0], store);
tryCatchReportPlatformFailures(() => {
importFileToStore(files[0], store);
}, `${IMPORT_FLIPPER_TRACE_EVENT}:UI`);
}
},
);