Skip to content

Commit

Permalink
chore: compatible with old e4d telemetryService usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxuanzhangsfdx committed Nov 10, 2023
1 parent 852bbb5 commit 85ee56c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/salesforcedx-utils-vscode/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export const TARGET_DEV_HUB_KEY = 'target-dev-hub';
export const TARGET_ORG_KEY = 'target-org';
export const SF_CONFIG_DISABLE_TELEMETRY = 'disable-telemetry';
export const DEFAULT_AIKEY = 'ec3632a4-df47-47a4-98dc-8134cacbaf7e';
export const SFDX_E4D_EXTENSION_NAME = 'salesforcedx-einstein-gpt';
1 change: 1 addition & 0 deletions packages/salesforcedx-utils-vscode/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export {
} from './context/workspaceContextUtil';
export {
TelemetryProvider,
TelemetryService,
TelemetryBuilder,
TelemetryData,
Properties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { env, ExtensionContext, ExtensionMode, workspace } from 'vscode';
import {
DEFAULT_AIKEY,
SFDX_CORE_CONFIGURATION_NAME,
SFDX_CORE_EXTENSION_NAME
SFDX_CORE_EXTENSION_NAME,
SFDX_E4D_EXTENSION_NAME
} from '../constants';
import { disableCLITelemetry, isCLITelemetryAllowed } from './cliConfiguration';
import { TelemetryReporter } from './telemetryReporter';
Expand Down Expand Up @@ -87,6 +88,10 @@ export class TelemetryService {
private reporter: TelemetryReporter | undefined;
private aiKey = DEFAULT_AIKEY;
private version: string = '';
// Temporary usage for earlier version of e4d
public static getInstance() {
return TelemetryProvider.getInstance(SFDX_E4D_EXTENSION_NAME);
}
/**
* Cached promise to check if CLI telemetry config is enabled
*/
Expand Down
4 changes: 3 additions & 1 deletion packages/salesforcedx-vscode-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
ChannelService,
getRootWorkspacePath,
SFDX_CORE_CONFIGURATION_NAME,
TelemetryProvider
TelemetryProvider,
TelemetryService
} from '@salesforce/salesforcedx-utils-vscode';
import * as vscode from 'vscode';
import { channelService } from './channels';
Expand Down Expand Up @@ -617,6 +618,7 @@ export async function activate(extensionContext: vscode.ExtensionContext) {
services: {
ChannelService,
TelemetryProvider,
TelemetryService,
WorkspaceContext
}
};
Expand Down

0 comments on commit 85ee56c

Please sign in to comment.