Track time for exports
Summary: This sometimes take *A LONG* time for me, so I want to know if I'm an outlier or not. Reviewed By: jknoxville Differential Revision: D15939147 fbshipit-source-id: 9ebd3914efdd537eeadd49e522397acc97a6ff9c
This commit is contained in:
committed by
Facebook Github Bot
parent
ab6fe68a70
commit
58c66a626d
@@ -83,7 +83,11 @@ export class App extends React.Component<Props> {
|
||||
return <SignInSheet onHide={onHide} />;
|
||||
case ACTIVE_SHEET_SHARE_DATA_IN_FILE:
|
||||
return (
|
||||
<ShareSheetExportFile onHide={onHide} file={this.props.exportFile} />
|
||||
<ShareSheetExportFile
|
||||
onHide={onHide}
|
||||
file={this.props.exportFile}
|
||||
logger={this.props.logger}
|
||||
/>
|
||||
);
|
||||
case ACTIVE_SHEET_PLUGIN_SHEET:
|
||||
// Currently unused.
|
||||
|
||||
@@ -16,6 +16,9 @@ import {
|
||||
Spacer,
|
||||
} from 'flipper';
|
||||
import {reportPlatformFailures} from '../utils/metrics';
|
||||
// $FlowFixMe: Missing type defs for node built-in.
|
||||
import {performance} from 'perf_hooks';
|
||||
import type {Logger} from '../fb-interfaces/Logger.js';
|
||||
import {
|
||||
exportStoreToFile,
|
||||
EXPORT_FLIPPER_TRACE_EVENT,
|
||||
@@ -66,6 +69,7 @@ const Padder = styled('div')(
|
||||
type Props = {
|
||||
onHide: () => mixed,
|
||||
file: ?string,
|
||||
logger: Logger,
|
||||
};
|
||||
type State = {
|
||||
errorArray: Array<Error>,
|
||||
@@ -86,18 +90,23 @@ export default class ShareSheetExportFile extends Component<Props, State> {
|
||||
};
|
||||
|
||||
async componentDidMount() {
|
||||
if (!this.props.file) {
|
||||
return;
|
||||
}
|
||||
|
||||
const mark = 'shareSheetExportFile';
|
||||
performance.mark(mark);
|
||||
try {
|
||||
// Flow doesn't allow us to check for this earlier because `performance` is untyped
|
||||
// and could presumably do anything.
|
||||
if (!this.props.file) {
|
||||
return;
|
||||
}
|
||||
const {errorArray} = await reportPlatformFailures(
|
||||
exportStoreToFile(this.props.file, this.context.store),
|
||||
`${EXPORT_FLIPPER_TRACE_EVENT}:UI_FILE`,
|
||||
);
|
||||
this.setState({errorArray, result: {success: true, error: null}});
|
||||
this.props.logger.trackTimeSince(mark, 'export:file-success');
|
||||
} catch (err) {
|
||||
this.setState({errorArray: [], result: {success: false, error: err}});
|
||||
this.props.logger.trackTimeSince(mark, 'export:file-error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import {readCurrentRevision} from './packageMetadata.js';
|
||||
import {tryCatchReportPlatformFailures} from './metrics';
|
||||
import {promisify} from 'util';
|
||||
import promiseTimeout from './promiseTimeout';
|
||||
import type {State} from '../reducers';
|
||||
|
||||
export const IMPORT_FLIPPER_TRACE_EVENT = 'import-flipper-trace';
|
||||
export const EXPORT_FLIPPER_TRACE_EVENT = 'export-flipper-trace';
|
||||
|
||||
Reference in New Issue
Block a user