Skip to content

Commit

Permalink
updating vscode-extension-telemetry package
Browse files Browse the repository at this point in the history
  • Loading branch information
vidorteg committed Jan 17, 2025
1 parent 35e9a08 commit ae5f88e
Show file tree
Hide file tree
Showing 16 changed files with 151 additions and 29 deletions.
138 changes: 128 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,12 @@
},
"dependencies": {
"@vscode/codicons": "0.0.36",
"@vscode/extension-telemetry":"0.9.4",
"bufferutil": "4.0.8",
"lit-html": "^3.2.0",
"puppeteer-core": "22.12.1",
"utf-8-validate": "6.0.4",
"vscode-chrome-debug-core": "6.8.11",
"vscode-extension-telemetry": "0.4.1",
"vscode-webhint": "2.1.15",
"ws": "8.18.0",
"xmlhttprequest": "1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion src/cdpTargetsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import * as vscode from 'vscode';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import * as path from 'path';
import * as fs from 'fs';
import { CDPTarget } from './cdpTarget';
Expand Down
4 changes: 2 additions & 2 deletions src/debugTelemetryReporter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';

export class DebugTelemetryReporter extends TelemetryReporter {
constructor() {
super('extensionId', 'extensionVersion', 'key');
super('key');
}

sendTelemetryEvent(
Expand Down
2 changes: 1 addition & 1 deletion src/devtoolsPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import * as vscode from 'vscode';
import * as debugCore from 'vscode-chrome-debug-core';
import { performance } from 'perf_hooks';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import { SettingsProvider } from './common/settingsProvider';
import {
encodeMessageForChannel,
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { Browser, Target, TargetType } from 'puppeteer-core';
import * as vscode from 'vscode';
import * as debugCore from 'vscode-chrome-debug-core';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import { CDPTarget } from './cdpTarget';
import { CDPTargetsProvider } from './cdpTargetsProvider';
import { DevToolsPanel } from './devtoolsPanel';
Expand Down
2 changes: 1 addition & 1 deletion src/launchDebugProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import * as vscode from 'vscode';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import {
IUserConfig,
SETTINGS_STORE_NAME,
Expand Down
2 changes: 1 addition & 1 deletion src/screencastPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
SETTINGS_SCREENCAST_WEBVIEW_NAME,
SETTINGS_VIEW_NAME,
} from './utils';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import { DevToolsPanel } from './devtoolsPanel';
import { providedHeadlessDebugConfig } from './launchConfigManager';

Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as path from 'path';
import * as url from 'url';
import * as vscode from 'vscode';
import * as debugCore from 'vscode-chrome-debug-core';
import TelemetryReporter from 'vscode-extension-telemetry';
import TelemetryReporter from '@vscode/extension-telemetry';
import packageJson from '../package.json';
import { DebugTelemetryReporter } from './debugTelemetryReporter';

Expand Down Expand Up @@ -338,7 +338,7 @@ export async function getJsDebugCDPProxyWebsocketUrl(debugSessionId: string): Pr
export function createTelemetryReporter(_context: vscode.ExtensionContext): Readonly<TelemetryReporter> {
if (packageJson && (_context.extensionMode === vscode.ExtensionMode.Production)) {
// Use the real telemetry reporter
return new TelemetryReporter(packageJson.name, packageJson.version, packageJson.aiKey);
return new TelemetryReporter(packageJson.aiKey);
}
// Fallback to a fake telemetry reporter
return new DebugTelemetryReporter();
Expand Down
2 changes: 1 addition & 1 deletion test/cdpTargetsProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// tslint:disable: variable-name

import { ExtensionContext } from "vscode";
import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";
import { CDPTarget } from "../src/cdpTarget";
import { createFakeExtensionContext, createFakeTelemetryReporter, createFakeVSCode, Mocked } from "./helpers/helpers";
import { IRemoteTargetJson } from "../src/utils";
Expand Down
2 changes: 1 addition & 1 deletion test/debugTelemetryReporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createFakeVSCode } from "./helpers/helpers";
// eslint-disable no-console

jest.mock("vscode", () => createFakeVSCode(), { virtual: true });
jest.mock("vscode-extension-telemetry");
jest.mock("@vscode/extension-telemetry");

describe("debugTelemetryReporter", () => {
it("gets created successfully", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/devtoolsPanel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// tslint:disable: variable-name

import { Disposable, ExtensionContext, WebviewPanel } from "vscode";
import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";
import { TelemetryData, webviewEventNames } from "../src/common/webviewEvents";
import { PanelSocket } from "../src/panelSocket";
import { JsDebugProxyPanelSocket } from "../src/JsDebugProxyPanelSocket";
Expand Down
2 changes: 1 addition & 1 deletion test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import { ExtensionContext, Uri} from "vscode";
import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";
import { createFakeExtensionContext, createFakeTelemetryReporter, createFakeVSCode, createFakeLanguageClient, Mocked } from "./helpers/helpers";
import {
buttonCode,
Expand Down
10 changes: 7 additions & 3 deletions test/helpers/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { ExtensionContext } from "vscode";
import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";

// Allow unused variables in the mocks to have leading underscore
// tslint:disable: variable-name
Expand Down Expand Up @@ -162,9 +162,13 @@ export function createFakeExtensionContext() {
export function createFakeTelemetryReporter(): Mocked<Readonly<TelemetryReporter>> {
return {
dispose: jest.fn(),
sendTelemetryErrorEvent: jest.fn(),
sendTelemetryEvent: jest.fn(),
sendTelemetryException: jest.fn(),
sendRawTelemetryEvent: jest.fn(),
sendDangerousTelemetryEvent: jest.fn(),
sendTelemetryErrorEvent: jest.fn(),
sendDangerousTelemetryErrorEvent: jest.fn(),
onDidChangeTelemetryLevel: jest.fn(),
telemetryLevel: "all"
};
}

Expand Down
2 changes: 1 addition & 1 deletion test/launchDebugProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import TelemetryReporter from "vscode-extension-telemetry";
import TelemetryReporter from "@vscode/extension-telemetry";
import { LaunchDebugProvider } from "../src/launchDebugProvider";
import {
createFakeExtensionContext,
Expand Down
2 changes: 1 addition & 1 deletion test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ describe("utils", () => {

it("returns a retail version when valid package in retail env", async () => {
const retailReporter = {};
jest.doMock("vscode-extension-telemetry", () => function retail() { return retailReporter; });
jest.doMock("@vscode/extension-telemetry", () => function retail() { return retailReporter; });
jest.resetModules();
jest.requireMock("vscode").env.machineId = "12345";

Expand Down

0 comments on commit ae5f88e

Please sign in to comment.