Skip to content

Commit c8aa070

Browse files
authored
Add telemetry when survey prompt is shown (#14940)
1 parent a87fb7b commit c8aa070

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

src/client/application/misc/joinMailingListPrompt.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export class JoinMailingListPrompt implements IExtensionSingleActivationService
5858

5959
@swallowExceptions('Failed to display tip')
6060
private async showTip(promptContent: string) {
61+
sendTelemetryEvent(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED);
6162
const selection = await this.shell.showInformationMessage(
6263
promptContent,
6364
Common.bannerLabelYes(),

src/client/telemetry/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export enum EventName {
7979
EXTENSION_SURVEY_PROMPT = 'EXTENSION_SURVEY_PROMPT',
8080
ACTIVATION_TIP_PROMPT = 'ACTIVATION_TIP_PROMPT',
8181
ACTIVATION_SURVEY_PROMPT = 'ACTIVATION_SURVEY_PROMPT',
82+
JOIN_MAILING_LIST_PROMPT_DISPLAYED = 'JOIN_MAILING_LIST_PROMPT_DISPLAYED',
8283
JOIN_MAILING_LIST_PROMPT = 'JOIN_MAILING_LIST_PROMPT',
8384

8485
PYTHON_LANGUAGE_SERVER_CURRENT_SELECTION = 'PYTHON_LANGUAGE_SERVER_CURRENT_SELECTION',

src/client/telemetry/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,10 @@ export interface IEventNamePropertyMapping {
13881388
/**
13891389
* Telemetry sent back when join mailing list prompt is shown.
13901390
*/
1391+
[EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED]: never | undefined;
1392+
/**
1393+
* Telemetry sent back when user selects an option from join mailing list prompt.
1394+
*/
13911395
[EventName.JOIN_MAILING_LIST_PROMPT]: {
13921396
/**
13931397
* Carries the selection of user when they are asked to join the mailing list.

src/test/application/misc/joinMailingListPrompt.unit.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { Common } from '../../../client/common/utils/localize';
1717
import * as telemetry from '../../../client/telemetry';
1818
import { EventName } from '../../../client/telemetry/constants';
1919

20-
suite('Interpreters - Interpreter Selection Tip', () => {
20+
suite('Join Mailing list Prompt Tests', () => {
2121
let joinMailingList: JoinMailingListPrompt;
2222
let appShell: IApplicationShell;
2323
let storage: IPersistentState<boolean>;
@@ -74,6 +74,7 @@ suite('Interpreters - Interpreter Selection Tip', () => {
7474

7575
await joinMailingList.activate();
7676

77+
assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED));
7778
verify(appShell.showInformationMessage(anything(), Common.bannerLabelYes(), Common.bannerLabelNo())).once();
7879
verify(storage.updateValue(true)).once();
7980
});
@@ -86,6 +87,7 @@ suite('Interpreters - Interpreter Selection Tip', () => {
8687

8788
await joinMailingList.activate();
8889

90+
assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED));
8991
verify(appShell.showInformationMessage(anything(), Common.bannerLabelYes(), Common.bannerLabelNo())).once();
9092
verify(storage.updateValue(true)).once();
9193
});
@@ -98,6 +100,7 @@ suite('Interpreters - Interpreter Selection Tip', () => {
98100

99101
await joinMailingList.activate();
100102

103+
assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED));
101104
verify(appShell.showInformationMessage(anything(), Common.bannerLabelYes(), Common.bannerLabelNo())).once();
102105
verify(storage.updateValue(true)).once();
103106
});
@@ -113,6 +116,7 @@ suite('Interpreters - Interpreter Selection Tip', () => {
113116

114117
await joinMailingList.activate();
115118

119+
assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED));
116120
verify(
117121
browserService.launch('https://aka.ms/python-vscode-mailinglist?m=test.sessionId&utm_source=vscode')
118122
).once();
@@ -133,6 +137,7 @@ suite('Interpreters - Interpreter Selection Tip', () => {
133137

134138
await joinMailingList.activate();
135139

140+
assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED));
136141
verify(storage.updateValue(true)).once();
137142
assert.ok(
138143
sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { selection: 'No' })
@@ -149,6 +154,7 @@ suite('Interpreters - Interpreter Selection Tip', () => {
149154

150155
await joinMailingList.activate();
151156

157+
assert.ok(sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT_DISPLAYED));
152158
verify(storage.updateValue(true)).once();
153159
assert.ok(
154160
sendTelemetryStub.calledWithExactly(EventName.JOIN_MAILING_LIST_PROMPT, undefined, { selection: undefined })

0 commit comments

Comments
 (0)