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

@@ -4,6 +4,7 @@
* LICENSE file in the root directory of this source tree.
* @format
*/
import {getInstance as getLogger} from '../fb-stubs/Logger';
import type {Store} from '../reducers';
import type {DeviceExport} from '../devices/BaseDevice';
import type {State as PluginStates} from '../reducers/pluginStates';
@@ -21,6 +22,9 @@ import uuid from 'uuid';
import {remote} from 'electron';
import {serialize, deserialize} from './serialization';
export const IMPORT_FLIPPER_TRACE_EVENT = 'import-flipper-trace';
export const EXPORT_FLIPPER_TRACE_EVENT = 'export-flipper-trace';
export type ExportType = {|
fileVersion: string,
clients: Array<ClientExport>,
@@ -226,6 +230,7 @@ export async function serializeStore(store: Store): Promise<?ExportType> {
}
export function exportStore(store: Store): Promise<string> {
getLogger().track('usage', EXPORT_FLIPPER_TRACE_EVENT);
return new Promise(async (resolve, reject) => {
const json = await serializeStore(store);
if (!json) {
@@ -255,6 +260,7 @@ export const exportStoreToFile = (
};
export function importDataToStore(data: string, store: Store) {
getLogger().track('usage', IMPORT_FLIPPER_TRACE_EVENT);
const json = deserialize(data);
const {device, clients} = json;
const {serial, deviceType, title, os, logs} = device;