fix start since launch metric (#5433)

This commit is contained in:
Elias Nahum 2021-06-07 15:16:49 -04:00 committed by GitHub
parent 66cc51d06e
commit 2cc4b00431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View file

@ -76,9 +76,7 @@ const launchApp = (credentials) => {
resetToSelectServer(emmProvider.allowOtherServers);
}
if (!EphemeralStore.appStarted) {
telemetry.startSinceLaunch(credentials ? 'Launch on Channel Screen' : 'Launch on Server Screen');
}
telemetry.startSinceLaunch(credentials ? 'Launch on Channel Screen' : 'Launch on Server Screen');
});
EphemeralStore.appStarted = true;

View file

@ -19,10 +19,12 @@ export const PERF_MARKERS = {
class Telemetry {
metrics: PerfMetric[];
currentMetrics: Record<string, PerfMetric>;
started: boolean;
constructor() {
this.metrics = [];
this.currentMetrics = {};
this.started = false;
}
getMetrics = () => {
@ -62,14 +64,17 @@ class Telemetry {
}
startSinceLaunch(extra = '') {
getTimeSinceStartup().then((endTime) => {
this.metrics.push({
extra,
name: PERF_MARKERS.START_SINCE_LAUNCH,
startTime: 0,
endTime,
if (!this.started) {
this.started = true;
getTimeSinceStartup().then((endTime) => {
this.metrics.push({
extra,
name: PERF_MARKERS.START_SINCE_LAUNCH,
startTime: 0,
endTime,
});
});
});
}
}
remove(names = []) {