Skip to content

Commit f8f747e

Browse files
authored
Disable error report if extension is not packaged by GHA (#68)
1 parent 71d7734 commit f8f747e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/services/telemetryService.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { Analytics, AnalyticsSettings } from '@segment/analytics-node';
88
import * as os from 'os';
99
import * as vscode from 'vscode';
1010

11+
const ProductionUntrustedSegmentKey = 'untrusted-dummy-key';
12+
1113
const analyticsClientFactory = async (gitpodHost: string, segmentKey: string, logger: vscode.LogOutputChannel): Promise<BaseTelemetryClient> => {
1214
const serviceUrl = new URL(gitpodHost);
1315

@@ -17,7 +19,7 @@ const analyticsClientFactory = async (gitpodHost: string, segmentKey: string, lo
1719
host: 'https://api.segment.io',
1820
path: '/v1/batch'
1921
};
20-
if (segmentKey === 'untrusted-dummy-key') {
22+
if (segmentKey === ProductionUntrustedSegmentKey) {
2123
settings.host = gitpodHost;
2224
settings.path = '/analytics' + settings.path;
2325
} else {
@@ -75,6 +77,10 @@ const analyticsClientFactory = async (gitpodHost: string, segmentKey: string, lo
7577
userId,
7678
properties,
7779
};
80+
if (segmentKey !== ProductionUntrustedSegmentKey) {
81+
logger.info('Local error report', jsonData);
82+
return;
83+
}
7884
fetch(errorMetricsEndpoint, {
7985
method: 'POST',
8086
body: JSON.stringify(jsonData),

0 commit comments

Comments
 (0)