Skip to content

Commit

Permalink
feat(ga): extends startup interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cianmSAP committed Sep 18, 2023
1 parent e688881 commit 986c24f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/ide-extension/src/panel/guidedAnswersPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export class GuidedAnswersPanel {
name: 'STARTUP',
properties: {
treeId: typeof this.startOptions?.treeId === 'number' ? this.startOptions?.treeId.toString() : '',
nodeIdPath: (this.startOptions?.nodeIdPath ?? []).join(':')
nodeIdPath: (this.startOptions?.nodeIdPath ?? []).join(':'),
trigger: this.startOptions?.trigger ?? ''
}
}).catch((error) => logger.logError(`Error tracking event 'STARTUP'`, error));
/**
Expand Down
1 change: 1 addition & 0 deletions packages/ide-extension/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export interface StartOptions {
treeId: GuidedAnswerTreeId;
nodeIdPath?: GuidedAnswerNodeId[];
openToSide?: boolean;
trigger?: string;
}
1 change: 1 addition & 0 deletions packages/ide-extension/src/types/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface TelemetryStartupEvent extends TelemetryBaseEvent {
properties: {
treeId: string;
nodeIdPath: string;
trigger: string;
};
}

Expand Down
8 changes: 6 additions & 2 deletions packages/ide-extension/test/telemetry/telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ describe('Telemetry trackEvent() tests', () => {
test('set common properties and track event, telemetry enabled', () => {
// Test execution
setCommonProperties({ ide: 'SBAS', devSpace: 'DevSpace', apiHost: 'any:host', apiVersion: 'v1' });
trackEvent({ name: 'STARTUP', properties: { treeId: 1, nodeIdPath: '2:3:4' } } as unknown as TelemetryEvent);
trackEvent({
name: 'STARTUP',
properties: { treeId: 1, nodeIdPath: '2:3:4', trigger: 'vsc-extension-mock' }
} as unknown as TelemetryEvent);

// Result check
expect(reporter.client.trackEvent).toBeCalledWith({
Expand All @@ -91,7 +94,8 @@ describe('Telemetry trackEvent() tests', () => {
'common.extname': packageJson.name,
'common.extversion': packageJson.version,
nodeIdPath: '2:3:4',
treeId: '1'
treeId: '1',
trigger: 'vsc-extension-mock'
}
});
});
Expand Down

0 comments on commit 986c24f

Please sign in to comment.