[client-app] Consolidate file download metric reporting

Summary: See title

Test Plan: manual

Reviewers: gleb, mark

Reviewed By: mark

Differential Revision: https://phab.nylas.com/D4256
This commit is contained in:
Juan Tejada 2017-03-23 13:18:42 -07:00
parent 1298d4c529
commit 09b88a759c

View file

@ -105,10 +105,11 @@ export class Download {
const onFailed = (err) => { const onFailed = (err) => {
Actions.recordPerfMetric({ Actions.recordPerfMetric({
action: 'file-download-failed', action: 'file-download',
accountId: this.accountId, accountId: this.accountId,
actionTimeMs: Date.now() - before, actionTimeMs: Date.now() - before,
maxValue: 10 * 60 * 1000, maxValue: 10 * 60 * 1000,
succeeded: false,
}) })
this.request = null; this.request = null;
stream.end(); stream.end();
@ -127,10 +128,11 @@ export class Download {
const onSuccess = () => { const onSuccess = () => {
Actions.recordPerfMetric({ Actions.recordPerfMetric({
action: 'file-download-succeeded', action: 'file-download',
accountId: this.accountId, accountId: this.accountId,
actionTimeMs: Date.now() - before, actionTimeMs: Date.now() - before,
maxValue: 10 * 60 * 1000, maxValue: 10 * 60 * 1000,
succeeded: true,
}) })
this.request = null; this.request = null;
stream.end(); stream.end();