Skip to content

Commit 733710e

Browse files
committed
Ensures that telemetry missingExpirity and skippedNonCloud events sent once
Makes sure that we don't send them too frequently: once per session, that's because we basically want to know if there are such cases at all and how many, rather than knowing exact numbes. (#4315)
1 parent 94e9fb5 commit 733710e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/plus/integrations/integration.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,15 @@ export abstract class IntegrationBase<
280280
await this.container.storage.deleteWorkspace(this.connectedKey);
281281
}
282282

283+
private skippedNonCloudReported = false;
283284
@log()
284285
async syncCloudConnection(state: 'connected' | 'disconnected', forceSync: boolean): Promise<void> {
285286
if (this._session?.cloud === false) {
286-
if (this.id !== HostingIntegrationId.GitHub) {
287+
if (this.id !== HostingIntegrationId.GitHub && !this.skippedNonCloudReported) {
287288
this.container.telemetry.sendEvent('cloudIntegrations/refreshConnection/skippedNonCloud', {
288289
'integration.id': this.id,
289290
});
291+
this.skippedNonCloudReported = true;
290292
}
291293
return;
292294
}
@@ -334,6 +336,7 @@ export abstract class IntegrationBase<
334336
return defaultValue;
335337
}
336338

339+
private missingExpirityReported = false;
337340
@gate()
338341
protected async refreshSessionIfExpired(scope?: LogScope): Promise<void> {
339342
if (this._session?.expiresAt != null && this._session.expiresAt < new Date()) {
@@ -343,10 +346,15 @@ export abstract class IntegrationBase<
343346
} catch (ex) {
344347
Logger.error(ex, scope);
345348
}
346-
} else if (this._session?.expiresAt == null && this.id !== HostingIntegrationId.GitHub) {
349+
} else if (
350+
this._session?.expiresAt == null &&
351+
this.id !== HostingIntegrationId.GitHub &&
352+
!this.missingExpirityReported
353+
) {
347354
this.container.telemetry.sendEvent('cloudIntegrations/refreshConnection/missingExpiry', {
348355
'integration.id': this.id,
349356
});
357+
this.missingExpirityReported = true;
350358
}
351359
}
352360

0 commit comments

Comments
 (0)