Skip to content

Commit dc193df

Browse files
author
Kartik Raj
committed
Remove API telemetry containing extensionId
1 parent 32b688e commit dc193df

File tree

4 files changed

+9
-47
lines changed

4 files changed

+9
-47
lines changed

src/client/deprecatedProposedApi.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import { ConfigurationTarget, EventEmitter } from 'vscode';
55
import { arePathsSame } from './common/platform/fs-paths';
6-
import { IExtensions, IInterpreterPathService, Resource } from './common/types';
6+
import { IInterpreterPathService, Resource } from './common/types';
77
import {
88
EnvironmentsChangedParams,
99
ActiveEnvironmentChangedParams,
@@ -61,21 +61,13 @@ export function buildDeprecatedProposedApi(
6161
): DeprecatedProposedAPI {
6262
const interpreterPathService = serviceContainer.get<IInterpreterPathService>(IInterpreterPathService);
6363
const interpreterService = serviceContainer.get<IInterpreterService>(IInterpreterService);
64-
const extensions = serviceContainer.get<IExtensions>(IExtensions);
6564
function sendApiTelemetry(apiName: string, warnLog = true) {
6665
if (warnLog) {
6766
console.warn('Extension is using deprecated python APIs which will be removed soon');
6867
}
69-
extensions
70-
.determineExtensionFromCallStack()
71-
.then((info) =>
72-
sendTelemetryEvent(EventName.PYTHON_ENVIRONMENTS_API, undefined, {
73-
apiName,
74-
extensionId: info.extensionId,
75-
displayName: info.displayName,
76-
}),
77-
)
78-
.ignoreErrors();
68+
sendTelemetryEvent(EventName.PYTHON_ENVIRONMENTS_API, undefined, {
69+
apiName,
70+
});
7971
}
8072

8173
const proposed: DeprecatedProposedAPI = {

src/client/proposedApi.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import { ConfigurationTarget, EventEmitter, Uri, WorkspaceFolder } from 'vscode';
66
import * as pathUtils from 'path';
7-
import { IConfigurationService, IDisposableRegistry, IExtensions, IInterpreterPathService } from './common/types';
7+
import { IConfigurationService, IDisposableRegistry, IInterpreterPathService } from './common/types';
88
import { Architecture } from './common/utils/platform';
99
import { IServiceContainer } from './ioc/types';
1010
import {
@@ -104,18 +104,10 @@ export function buildProposedApi(
104104
const interpreterPathService = serviceContainer.get<IInterpreterPathService>(IInterpreterPathService);
105105
const configService = serviceContainer.get<IConfigurationService>(IConfigurationService);
106106
const disposables = serviceContainer.get<IDisposableRegistry>(IDisposableRegistry);
107-
const extensions = serviceContainer.get<IExtensions>(IExtensions);
108107
function sendApiTelemetry(apiName: string) {
109-
extensions
110-
.determineExtensionFromCallStack()
111-
.then((info) =>
112-
sendTelemetryEvent(EventName.PYTHON_ENVIRONMENTS_API, undefined, {
113-
apiName,
114-
extensionId: info.extensionId,
115-
displayName: info.displayName,
116-
}),
117-
)
118-
.ignoreErrors();
108+
sendTelemetryEvent(EventName.PYTHON_ENVIRONMENTS_API, undefined, {
109+
apiName,
110+
});
119111
}
120112
disposables.push(
121113
discoveryApi.onChanged((e) => {

src/client/telemetry/index.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -1114,19 +1114,10 @@ export interface IEventNamePropertyMapping {
11141114
*/
11151115
/* __GDPR__
11161116
"python_environments_api" : {
1117-
"extensionId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": false , "owner": "karrtikr"},
1118-
"displayName" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": false, "owner": "karrtikr" }
1117+
"apiName" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": false, "owner": "karrtikr" }
11191118
}
11201119
*/
11211120
[EventName.PYTHON_ENVIRONMENTS_API]: {
1122-
/**
1123-
* The ID of the extension calling the API.
1124-
*/
1125-
extensionId: string;
1126-
/**
1127-
* The name of the extension as displayed in marketplace.
1128-
*/
1129-
displayName: string;
11301121
/**
11311122
* The name of the API called.
11321123
*/

src/test/proposedApi.unit.test.ts

-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { cloneDeep } from 'lodash';
88
import {
99
IConfigurationService,
1010
IDisposableRegistry,
11-
IExtensions,
1211
IInterpreterPathService,
1312
IPythonSettings,
1413
} from '../client/common/types';
@@ -39,7 +38,6 @@ suite('Proposed Extension API', () => {
3938
let discoverAPI: typemoq.IMock<IDiscoveryAPI>;
4039
let interpreterPathService: typemoq.IMock<IInterpreterPathService>;
4140
let configService: typemoq.IMock<IConfigurationService>;
42-
let extensions: typemoq.IMock<IExtensions>;
4341
let onDidChangeRefreshState: EventEmitter<ProgressNotificationEvent>;
4442
let onDidChangeEnvironments: EventEmitter<PythonEnvCollectionChangedEvent>;
4543

@@ -48,17 +46,11 @@ suite('Proposed Extension API', () => {
4846
setup(() => {
4947
serviceContainer = typemoq.Mock.ofType<IServiceContainer>();
5048
discoverAPI = typemoq.Mock.ofType<IDiscoveryAPI>();
51-
extensions = typemoq.Mock.ofType<IExtensions>();
52-
extensions
53-
.setup((e) => e.determineExtensionFromCallStack())
54-
.returns(() => Promise.resolve({ extensionId: 'id', displayName: 'displayName', apiName: 'apiName' }))
55-
.verifiable(typemoq.Times.atLeastOnce());
5649
interpreterPathService = typemoq.Mock.ofType<IInterpreterPathService>();
5750
configService = typemoq.Mock.ofType<IConfigurationService>();
5851
onDidChangeRefreshState = new EventEmitter();
5952
onDidChangeEnvironments = new EventEmitter();
6053

61-
serviceContainer.setup((s) => s.get(IExtensions)).returns(() => extensions.object);
6254
serviceContainer.setup((s) => s.get(IInterpreterPathService)).returns(() => interpreterPathService.object);
6355
serviceContainer.setup((s) => s.get(IConfigurationService)).returns(() => configService.object);
6456
serviceContainer.setup((s) => s.get(IDisposableRegistry)).returns(() => []);
@@ -69,11 +61,6 @@ suite('Proposed Extension API', () => {
6961
proposed = buildProposedApi(discoverAPI.object, serviceContainer.object);
7062
});
7163

72-
teardown(() => {
73-
// Verify each API method sends telemetry regarding who called the API.
74-
extensions.verifyAll();
75-
});
76-
7764
test('Provide an event to track when active environment details change', async () => {
7865
const events: ActiveEnvironmentPathChangeEvent[] = [];
7966
proposed.environment.onDidChangeActiveEnvironmentPath((e) => {

0 commit comments

Comments
 (0)