diff --git a/extension/src/telemetry/constants.ts b/extension/src/telemetry/constants.ts index 0bbe21bd76..2ec4668d7e 100644 --- a/extension/src/telemetry/constants.ts +++ b/extension/src/telemetry/constants.ts @@ -5,7 +5,6 @@ import { SortDefinition } from '../experiments/model/sortBy' import { Section, SectionCollapsed } from '../plots/webview/contract' export const APPLICATION_INSIGHTS_KEY = '46e8e554-d50a-471a-a53b-4af2b1cd6594' -export const EXTENSION_ID = 'iterative.dvc' const ViewOpenedEvent = { VIEWS_EXPERIMENTS_FILTER_BY_TREE_OPENED: diff --git a/extension/src/telemetry/index.test.ts b/extension/src/telemetry/index.test.ts index cafc9d7d4e..f651aa5d38 100644 --- a/extension/src/telemetry/index.test.ts +++ b/extension/src/telemetry/index.test.ts @@ -1,24 +1,13 @@ -import { extensions } from 'vscode' -// eslint-disable-next-line import/default import TelemetryReporter from '@vscode/extension-telemetry' import { getTelemetryReporter, sendTelemetryEvent } from '.' import { APPLICATION_INSIGHTS_KEY, - EXTENSION_ID, IEventNamePropertyMapping } from './constants' import { getUserId } from './uuid' const mockedTelemetryReporter = jest.mocked(TelemetryReporter) -const mockedExtensions = jest.mocked(extensions) -const mockedGetExtension = jest.fn() -mockedExtensions.getExtension = mockedGetExtension -const mockedPackageJSON = { - id: EXTENSION_ID, - name: 'dvc', - version: '0.1.0' -} const mockedSendTelemetryEvent = jest.fn() const mockedGetUserId = jest.mocked(getUserId) @@ -46,20 +35,12 @@ describe('getTelemetryReporter', () => { let telemetryReporter: TelemetryReporter | undefined it('should create a reporter on the first call', () => { - mockedGetExtension.mockReturnValueOnce({ - packageJSON: mockedPackageJSON - }) telemetryReporter = getTelemetryReporter() expect(telemetryReporter).toBeDefined() - expect(mockedGetExtension).toHaveBeenCalledTimes(1) - expect(mockedGetExtension).toHaveBeenCalledWith('iterative.dvc') expect(mockedTelemetryReporter).toHaveBeenCalledTimes(1) expect(mockedTelemetryReporter).toHaveBeenCalledWith( - EXTENSION_ID, - mockedPackageJSON.version, - APPLICATION_INSIGHTS_KEY, - true + APPLICATION_INSIGHTS_KEY ) }) @@ -68,7 +49,6 @@ describe('getTelemetryReporter', () => { expect(telemetryReporter).toStrictEqual(sameTelemetryReporter) expect(mockedTelemetryReporter).not.toHaveBeenCalled() - expect(mockedGetExtension).not.toHaveBeenCalled() }) }) diff --git a/extension/src/telemetry/index.ts b/extension/src/telemetry/index.ts index fdd866c825..9ad48af560 100644 --- a/extension/src/telemetry/index.ts +++ b/extension/src/telemetry/index.ts @@ -1,14 +1,12 @@ // eslint-disable-next-line import/default import TelemetryReporter from '@vscode/extension-telemetry' import { - EXTENSION_ID, APPLICATION_INSIGHTS_KEY, IEventNamePropertyMapping, ViewOpenedEventName } from './constants' import { getUserId } from './uuid' import { Logger } from '../common/logger' -import { getExtensionVersion } from '../vscode/extensions' const isTestExecution = (): boolean => !!process.env.VSC_TEST || process.env.NODE_ENV === 'test' @@ -20,14 +18,7 @@ export const getTelemetryReporter = (): TelemetryReporter => { return telemetryReporter } - const version = getExtensionVersion(EXTENSION_ID) || 'unknown' - - telemetryReporter = new TelemetryReporter( - EXTENSION_ID, - version, - APPLICATION_INSIGHTS_KEY, - true - ) + telemetryReporter = new TelemetryReporter(APPLICATION_INSIGHTS_KEY) return telemetryReporter } diff --git a/extension/src/vscode/extensions.ts b/extension/src/vscode/extensions.ts index bec53bdfde..d25b0433c2 100644 --- a/extension/src/vscode/extensions.ts +++ b/extension/src/vscode/extensions.ts @@ -26,16 +26,6 @@ export const getExtensionAPI = async ( } catch {} } -export const getExtensionVersion = (id: string): string | undefined => { - const extension = getExtension(id) - - if (!extension) { - return - } - - return (extension.packageJSON as { version: string }).version -} - export const isInstalled = (id: string): boolean => !!extensions.all.some(extension => extension.id === id)