Skip to content

Commit 2342443

Browse files
committed
Set telemetry setting based on disable-telemetry flag
By design the disable-telemetry flag does not affect extension telemetry, only the setting does, so disabling the setting when the flag is set should cause extensions to also stop sending telemetry. Fixes #1116.
1 parent 26647c5 commit 2342443

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

ci/vscode.patch

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,10 @@ index eab8591492..26668701f7 100644
486486
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
487487
diff --git a/src/vs/server/browser/client.ts b/src/vs/server/browser/client.ts
488488
new file mode 100644
489-
index 0000000000..95e70869f2
489+
index 0000000000..3f53907de0
490490
--- /dev/null
491491
+++ b/src/vs/server/browser/client.ts
492-
@@ -0,0 +1,224 @@
492+
@@ -0,0 +1,227 @@
493493
+import { Emitter } from 'vs/base/common/event';
494494
+import { URI } from 'vs/base/common/uri';
495495
+import { localize } from 'vs/nls';
@@ -518,6 +518,9 @@ index 0000000000..95e70869f2
518518
+
519519
+const TELEMETRY_SECTION_ID = 'telemetry';
520520
+
521+
+const el = document.getElementById("vscode-disable-telemetry");
522+
+const disableTelemetry = el && el.getAttribute("data-value") === "true" || false;
523+
+
521524
+Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({
522525
+ 'id': TELEMETRY_SECTION_ID,
523526
+ 'order': 110,
@@ -527,7 +530,7 @@ index 0000000000..95e70869f2
527530
+ 'telemetry.enableTelemetry': {
528531
+ 'type': 'boolean',
529532
+ 'description': localize('telemetry.enableTelemetry', 'Enable usage data and errors to be sent to a Microsoft online service.'),
530-
+ 'default': true,
533+
+ 'default': !disableTelemetry,
531534
+ 'tags': ['usesOnlineServices']
532535
+ }
533536
+ }

src/browser/pages/vscode.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<meta id="vscode-remote-commit" data-settings="{{COMMIT}}" />
2424
<meta id="vscode-remote-product-configuration" data-settings="{{PRODUCT_CONFIGURATION}}" />
2525
<meta id="vscode-remote-nls-configuration" data-settings="{{NLS_CONFIGURATION}}" />
26+
<meta id="vscode-disable-telemetry" data-value="{{DISABLE_TELEMETRY}}" />
2627

2728
<!-- Workbench Icon/Manifest/CSS -->
2829
<link rel="icon" href="{{BASE}}/static/{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />

src/node/app/vscode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export class VscodeHttpProvider extends HttpProvider {
205205
.replace(`"{{PRODUCT_CONFIGURATION}}"`, `'${JSON.stringify(options.productConfiguration)}'`)
206206
.replace(`"{{WORKBENCH_WEB_CONFIGURATION}}"`, `'${JSON.stringify(options.workbenchWebConfiguration)}'`)
207207
.replace(`"{{NLS_CONFIGURATION}}"`, `'${JSON.stringify(options.nlsConfiguration)}'`)
208+
.replace("{{DISABLE_TELEMETRY}}", this.args["disable-telemetry"] ? "true" : "false")
208209
return this.replaceTemplates(route, response)
209210
}
210211

0 commit comments

Comments
 (0)