@codingame/monaco-vscode-telemetry-service-override 30.0.1 → 31.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-telemetry-service-override",
3
- "version": "30.0.1",
3
+ "version": "31.0.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - telemetry service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "30.0.1",
18
+ "@codingame/monaco-vscode-api": "31.0.0",
19
19
  "@microsoft/1ds-core-js": "3.2.18",
20
20
  "@microsoft/1ds-post-js": "3.2.18"
21
21
  },
@@ -1,4 +1,4 @@
1
- import BaseErrorTelemetry from "../common/errorTelemetry.js";
1
+ import BaseErrorTelemetry from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/errorTelemetry";
2
2
  export default class ErrorTelemetry extends BaseErrorTelemetry {
3
3
  protected installErrorListeners(): void;
4
4
  private _onUncaughtError;
@@ -2,7 +2,7 @@
2
2
  import { mainWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/window';
3
3
  import { ErrorNoTelemetry } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
4
4
  import { toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
- import BaseErrorTelemetry from '../common/errorTelemetry.js';
5
+ import BaseErrorTelemetry from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/errorTelemetry';
6
6
 
7
7
  class ErrorTelemetry extends BaseErrorTelemetry {
8
8
  installErrorListeners() {
@@ -19,7 +19,7 @@ let TelemetryLogAppender = class TelemetryLogAppender extends Disposable {
19
19
  const justLoggingAndNotSending = isLoggingOnly(productService, environmentService);
20
20
  const logSuffix = justLoggingAndNotSending ? " (Not Sent)" : "";
21
21
  this.logger = this._register(loggerService.createLogger(id, {
22
- name: ( localize(2108, "Telemetry{0}", logSuffix)),
22
+ name: ( localize(2111, "Telemetry{0}", logSuffix)),
23
23
  group: TelemetryLogGroup,
24
24
  hidden: true
25
25
  }));
@@ -48,6 +48,7 @@ export declare class TelemetryService implements ITelemetryService {
48
48
  private _cleanupPatterns;
49
49
  constructor(config: ITelemetryServiceConfig, _configurationService: IConfigurationService, _productService: IProductService);
50
50
  setExperimentProperty(name: string, value: string): void;
51
+ setCommonProperty(name: string, value: string): void;
51
52
  private _flushPendingEvents;
52
53
  private _updateTelemetryLevel;
53
54
  get sendErrorTelemetry(): boolean;
@@ -12,7 +12,7 @@ import product from '@codingame/monaco-vscode-api/vscode/vs/platform/product/com
12
12
  import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
13
13
  import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
14
14
  import { TelemetryLevel, TELEMETRY_SETTING_ID, TELEMETRY_OLD_SETTING_ID, TELEMETRY_CRASH_REPORTER_SETTING_ID, TelemetryConfiguration, TELEMETRY_SECTION_ID } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry';
15
- import { getTelemetryLevel, cleanData } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetryUtils';
15
+ import { TelemetryTrustedValue, getTelemetryLevel, cleanData } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetryUtils';
16
16
 
17
17
  var TelemetryService_1;
18
18
  let TelemetryService = class TelemetryService {
@@ -72,11 +72,14 @@ let TelemetryService = class TelemetryService {
72
72
  }
73
73
  }
74
74
  setExperimentProperty(name, value) {
75
- this._experimentProperties[name] = value;
75
+ this._experimentProperties[name] = ( new TelemetryTrustedValue(value));
76
76
  if (!this._isExperimentPropertySet) {
77
77
  this._flushPendingEvents();
78
78
  }
79
79
  }
80
+ setCommonProperty(name, value) {
81
+ this._commonProperties[name] = value;
82
+ }
80
83
  _flushPendingEvents() {
81
84
  if (this._isExperimentPropertySet) {
82
85
  return;
@@ -134,6 +137,12 @@ let TelemetryService = class TelemetryService {
134
137
  data = mixin(data, this._experimentProperties);
135
138
  data = cleanData(data, this._cleanupPatterns);
136
139
  data = mixin(data, this._commonProperties);
140
+ if (eventLevel === TelemetryLevel.ERROR) {
141
+ data = {
142
+ ...data,
143
+ "isError": true
144
+ };
145
+ }
137
146
  this._appenders.forEach(a => a.log(eventName, data ?? {}));
138
147
  }
139
148
  publicLog(eventName, data) {
@@ -155,28 +164,28 @@ let TelemetryService = class TelemetryService {
155
164
  TelemetryService = TelemetryService_1 = ( __decorate([( __param(1, IConfigurationService)), ( __param(2, IProductService))], TelemetryService));
156
165
  function getTelemetryLevelSettingDescription() {
157
166
  const telemetryText = ( localize(
158
- 2109,
167
+ 2112,
159
168
  "Controls {0} telemetry, first-party extension telemetry, and participating third-party extension telemetry. Some third party extensions might not respect this setting. Consult the specific extension's documentation to be sure. Telemetry helps us better understand how {0} is performing, where improvements need to be made, and how features are being used.",
160
169
  product.nameLong
161
170
  ));
162
171
  const externalLinksStatement = !product.privacyStatementUrl ? ( localize(
163
- 2110,
172
+ 2113,
164
173
  "Read more about the [data we collect]({0}).",
165
174
  "https://aka.ms/vscode-telemetry"
166
175
  )) : ( localize(
167
- 2111,
176
+ 2114,
168
177
  "Read more about the [data we collect]({0}) and our [privacy statement]({1}).",
169
178
  "https://aka.ms/vscode-telemetry",
170
179
  product.privacyStatementUrl
171
180
  ));
172
181
  const restartString = !isWeb ? ( localize(
173
- 2112,
182
+ 2115,
174
183
  "A full restart of the application is necessary for crash reporting changes to take effect."
175
184
  )) : "";
176
- const crashReportsHeader = ( localize(2113, "Crash Reports"));
177
- const errorsHeader = ( localize(2114, "Error Telemetry"));
178
- const usageHeader = ( localize(2115, "Usage Data"));
179
- const telemetryTableDescription = ( localize(2116, "The following table outlines the data sent with each setting:"));
185
+ const crashReportsHeader = ( localize(2116, "Crash Reports"));
186
+ const errorsHeader = ( localize(2117, "Error Telemetry"));
187
+ const usageHeader = ( localize(2118, "Usage Data"));
188
+ const telemetryTableDescription = ( localize(2119, "The following table outlines the data sent with each setting:"));
180
189
  const telemetryTable = `
181
190
  | | ${crashReportsHeader} | ${errorsHeader} | ${usageHeader} |
182
191
  |:------|:-------------:|:---------------:|:----------:|
@@ -186,7 +195,7 @@ function getTelemetryLevelSettingDescription() {
186
195
  | off | - | - | - |
187
196
  `;
188
197
  const deprecatedSettingNote = ( localize(
189
- 2117,
198
+ 2120,
190
199
  "****Note:*** If this setting is 'off', no telemetry will be sent regardless of other telemetry settings. If this setting is set to anything except 'off' and telemetry is disabled with deprecated settings, no telemetry will be sent.*"
191
200
  ));
192
201
  const telemetryDescription = `
@@ -208,7 +217,7 @@ configurationRegistry.registerConfiguration({
208
217
  "id": TELEMETRY_SECTION_ID,
209
218
  "order": 1,
210
219
  "type": "object",
211
- "title": ( localize(2118, "Telemetry")),
220
+ "title": ( localize(2121, "Telemetry")),
212
221
  "properties": {
213
222
  [TELEMETRY_SETTING_ID]: {
214
223
  "type": "string",
@@ -218,7 +227,7 @@ configurationRegistry.registerConfiguration({
218
227
  TelemetryConfiguration.CRASH,
219
228
  TelemetryConfiguration.OFF
220
229
  ],
221
- "enumDescriptions": [( localize(2119, "Sends usage data, errors, and crash reports.")), ( localize(2120, "Sends general error telemetry and crash reports.")), ( localize(2121, "Sends OS level crash reports.")), ( localize(2122, "Disables all product telemetry."))],
230
+ "enumDescriptions": [( localize(2122, "Sends usage data, errors, and crash reports.")), ( localize(2123, "Sends general error telemetry and crash reports.")), ( localize(2124, "Sends OS level crash reports.")), ( localize(2125, "Disables all product telemetry."))],
222
231
  "markdownDescription": getTelemetryLevelSettingDescription(),
223
232
  "default": TelemetryConfiguration.ON,
224
233
  "restricted": true,
@@ -231,20 +240,20 @@ configurationRegistry.registerConfiguration({
231
240
  localization: {
232
241
  description: {
233
242
  key: "telemetry.telemetryLevel.policyDescription",
234
- value: ( localize(2123, "Controls the level of telemetry."))
243
+ value: ( localize(2126, "Controls the level of telemetry."))
235
244
  },
236
245
  enumDescriptions: [{
237
246
  key: "telemetry.telemetryLevel.default",
238
- value: ( localize(2119, "Sends usage data, errors, and crash reports."))
247
+ value: ( localize(2122, "Sends usage data, errors, and crash reports."))
239
248
  }, {
240
249
  key: "telemetry.telemetryLevel.error",
241
- value: ( localize(2120, "Sends general error telemetry and crash reports."))
250
+ value: ( localize(2123, "Sends general error telemetry and crash reports."))
242
251
  }, {
243
252
  key: "telemetry.telemetryLevel.crash",
244
- value: ( localize(2121, "Sends OS level crash reports."))
253
+ value: ( localize(2124, "Sends OS level crash reports."))
245
254
  }, {
246
255
  key: "telemetry.telemetryLevel.off",
247
- value: ( localize(2122, "Disables all product telemetry."))
256
+ value: ( localize(2125, "Disables all product telemetry."))
248
257
  }]
249
258
  }
250
259
  }
@@ -253,7 +262,7 @@ configurationRegistry.registerConfiguration({
253
262
  type: "boolean",
254
263
  default: true,
255
264
  description: ( localize(
256
- 2124,
265
+ 2127,
257
266
  "Enable feedback mechanisms such as the issue reporter, surveys, and other feedback options."
258
267
  )),
259
268
  policy: {
@@ -264,7 +273,7 @@ configurationRegistry.registerConfiguration({
264
273
  description: {
265
274
  key: "telemetry.feedback.enabled",
266
275
  value: ( localize(
267
- 2124,
276
+ 2127,
268
277
  "Enable feedback mechanisms such as the issue reporter, surveys, and other feedback options."
269
278
  ))
270
279
  }
@@ -274,11 +283,11 @@ configurationRegistry.registerConfiguration({
274
283
  [TELEMETRY_OLD_SETTING_ID]: {
275
284
  "type": "boolean",
276
285
  "markdownDescription": !product.privacyStatementUrl ? ( localize(
277
- 2125,
286
+ 2128,
278
287
  "Enable diagnostic data to be collected. This helps us to better understand how {0} is performing and where improvements need to be made.",
279
288
  product.nameLong
280
289
  )) : ( localize(
281
- 2126,
290
+ 2129,
282
291
  "Enable diagnostic data to be collected. This helps us to better understand how {0} is performing and where improvements need to be made. [Read more]({1}) about what we collect and our privacy statement.",
283
292
  product.nameLong,
284
293
  product.privacyStatementUrl
@@ -286,7 +295,7 @@ configurationRegistry.registerConfiguration({
286
295
  "default": true,
287
296
  "restricted": true,
288
297
  "markdownDeprecationMessage": ( localize(
289
- 2127,
298
+ 2130,
290
299
  "If this setting is false, no telemetry will be sent regardless of the new setting's value. Deprecated in favor of the {0} setting.",
291
300
  `\`#${TELEMETRY_SETTING_ID}#\``
292
301
  )),
@@ -176,7 +176,7 @@ let TelemetryContribution = class TelemetryContribution extends Disposable {
176
176
  constructor() {
177
177
  super({
178
178
  id: "workbench.action.showTelemetry",
179
- title: ( localize2(13327, "Show Telemetry")),
179
+ title: ( localize2(13462, "Show Telemetry")),
180
180
  category: Categories.Developer,
181
181
  f1: true
182
182
  });
@@ -335,6 +335,7 @@ let ConfigurationTelemetryContribution = class ConfigurationTelemetryContributio
335
335
  });
336
336
  return;
337
337
  case TerminalContribSettingId.AgentSandboxEnabled:
338
+ case TerminalContribSettingId.DeprecatedAgentSandboxEnabled:
338
339
  this.telemetryService.publicLog2("chat.agent.sandbox", {
339
340
  settingValue: this.getValueToReport(key, target),
340
341
  source
@@ -28,6 +28,7 @@ export declare class TelemetryService extends Disposable implements ITelemetrySe
28
28
  */
29
29
  private initializeService;
30
30
  setExperimentProperty(name: string, value: string): void;
31
+ setCommonProperty(name: string, value: string): void;
31
32
  get telemetryLevel(): TelemetryLevel;
32
33
  publicLog(eventName: string, data?: ITelemetryData): void;
33
34
  publicLog2<E extends ClassifiedEvent<OmitMetadata<T>> = never, T extends IGDPRProperty = never>(eventName: string, data?: StrictPropertyCheck<T, E>): void;
@@ -132,6 +132,9 @@ let TelemetryService = class TelemetryService extends Disposable {
132
132
  setExperimentProperty(name, value) {
133
133
  return this.impl.setExperimentProperty(name, value);
134
134
  }
135
+ setCommonProperty(name, value) {
136
+ this.impl.setCommonProperty(name, value);
137
+ }
135
138
  get telemetryLevel() {
136
139
  return this.impl.telemetryLevel;
137
140
  }
@@ -1,29 +0,0 @@
1
- import { DisposableStore } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
3
- export interface ErrorEvent {
4
- callstack: string;
5
- msg?: string;
6
- file?: string;
7
- line?: number;
8
- column?: number;
9
- uncaught_error_name?: string;
10
- uncaught_error_msg?: string;
11
- count?: number;
12
- }
13
- export declare namespace ErrorEvent {
14
- function compare(a: ErrorEvent, b: ErrorEvent): 1 | 0 | -1;
15
- }
16
- export default abstract class BaseErrorTelemetry {
17
- static ERROR_FLUSH_TIMEOUT: number;
18
- private _telemetryService;
19
- private _flushDelay;
20
- private _flushHandle;
21
- private _buffer;
22
- protected readonly _disposables: DisposableStore;
23
- constructor(telemetryService: ITelemetryService, flushDelay?: number);
24
- dispose(): void;
25
- protected installErrorListeners(): void;
26
- private _onErrorEvent;
27
- protected _enqueue(e: ErrorEvent): void;
28
- private _flushBuffer;
29
- }
@@ -1,86 +0,0 @@
1
-
2
- import { binarySearch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
3
- import { errorHandler, ErrorNoTelemetry, PendingMigrationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
4
- import { DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
- import { safeStringify } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
6
- import { FileOperationError } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
7
-
8
- var ErrorEvent;
9
- (function(ErrorEvent) {
10
- function compare(a, b) {
11
- if (a.callstack < b.callstack) {
12
- return -1;
13
- } else if (a.callstack > b.callstack) {
14
- return 1;
15
- }
16
- return 0;
17
- }
18
- ErrorEvent.compare = compare;
19
- })(ErrorEvent || (ErrorEvent = {}));
20
- class BaseErrorTelemetry {
21
- static {
22
- this.ERROR_FLUSH_TIMEOUT = 5 * 1000;
23
- }
24
- constructor(telemetryService, flushDelay = BaseErrorTelemetry.ERROR_FLUSH_TIMEOUT) {
25
- this._flushHandle = undefined;
26
- this._buffer = [];
27
- this._disposables = ( new DisposableStore());
28
- this._telemetryService = telemetryService;
29
- this._flushDelay = flushDelay;
30
- const unbind = errorHandler.addListener(err => this._onErrorEvent(err));
31
- this._disposables.add(toDisposable(unbind));
32
- this.installErrorListeners();
33
- }
34
- dispose() {
35
- clearTimeout(this._flushHandle);
36
- this._flushBuffer();
37
- this._disposables.dispose();
38
- }
39
- installErrorListeners() {}
40
- _onErrorEvent(err) {
41
- if (!err || err.code) {
42
- return;
43
- }
44
- if (err.detail && err.detail.stack) {
45
- err = err.detail;
46
- }
47
- if (ErrorNoTelemetry.isErrorNoTelemetry(err) || err instanceof FileOperationError || PendingMigrationError.is(err) || (typeof err?.message === "string" && err.message.includes("Unable to read file"))) {
48
- return;
49
- }
50
- const callstack = Array.isArray(err.stack) ? err.stack.join("\n") : err.stack;
51
- const msg = err.message ? err.message : safeStringify(err);
52
- if (!callstack) {
53
- return;
54
- }
55
- this._enqueue({
56
- msg,
57
- callstack
58
- });
59
- }
60
- _enqueue(e) {
61
- const idx = binarySearch(this._buffer, e, ErrorEvent.compare);
62
- if (idx < 0) {
63
- e.count = 1;
64
- this._buffer.splice(~idx, 0, e);
65
- } else {
66
- if (!this._buffer[idx].count) {
67
- this._buffer[idx].count = 0;
68
- }
69
- this._buffer[idx].count += 1;
70
- }
71
- if (this._flushHandle === undefined) {
72
- this._flushHandle = setTimeout(() => {
73
- this._flushBuffer();
74
- this._flushHandle = undefined;
75
- }, this._flushDelay);
76
- }
77
- }
78
- _flushBuffer() {
79
- for (const error of this._buffer) {
80
- this._telemetryService.publicLogError2("UnhandledError", error);
81
- }
82
- this._buffer.length = 0;
83
- }
84
- }
85
-
86
- export { ErrorEvent, BaseErrorTelemetry as default };