Update ads-extension-telemetry to 1.3.1 (#20724)

* Update ads-extension-telemetry to 1.3.0

* fix
This commit is contained in:
Charles Gagnon
2022-10-04 23:06:53 -07:00
committed by GitHub
parent 08341c70fd
commit 60c1c8a89f
37 changed files with 92 additions and 130 deletions

View File

@@ -7,7 +7,7 @@ import { getPackageInfo } from './utils';
const packageInfo = getPackageInfo()!;
export const TelemetryReporter = new AdsTelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
export const TelemetryReporter = new AdsTelemetryReporter<TelemetryViews, TelemetryActions | CreateAzureFunctionStep>(packageInfo.name, packageInfo.version, packageInfo.aiKey);
export enum TelemetryViews {
SqlBindingsQuickPick = 'SqlBindingsQuickPick',
@@ -51,6 +51,8 @@ export enum CreateAzureFunctionStep {
getTemplateId = 'getTemplateId',
getConnectionStringSettingName = 'getConnectionStringSettingName',
promptForIncludePassword = 'promptForIncludePassword',
createFunctionAPI = 'createFunctionAPI',
finishCreateFunction = 'finishCreateFunction'
}
export enum ExitReason {

View File

@@ -21,7 +21,7 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
// telemetry properties for create azure function
let sessionId: string = uuid.v4();
let propertyBag: { [key: string]: string } = { sessionId: sessionId };
let telemetryStep: string = '';
let telemetryStep: CreateAzureFunctionStep | undefined = undefined;
let exitReason: string = ExitReason.cancelled;
TelemetryReporter.sendActionEvent(TelemetryViews.CreateAzureFunctionWithSqlBinding, TelemetryActions.startCreateAzureFunctionWithSqlBinding);
let connectionInfo: IConnectionInfo | undefined;
@@ -239,7 +239,7 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
let connectionStringExecuteStep = createAddConnectionStringStep(projectFolder, connectionInfo, connectionStringInfo.connectionStringSettingName);
// create C# Azure Function with SQL Binding
telemetryStep = 'createFunctionAPI';
telemetryStep = CreateAzureFunctionStep.createFunctionAPI;
await azureFunctionApi.createFunction({
language: 'C#',
targetFramework: 'netcoreapp3.1',
@@ -263,7 +263,7 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
.withAdditionalProperties(propertyBag)
.withConnectionInfo(connectionInfo).send();
telemetryStep = 'finishCreateFunction';
telemetryStep = CreateAzureFunctionStep.finishCreateFunction;
propertyBag.telemetryStep = telemetryStep;
exitReason = ExitReason.finishCreate;
TelemetryReporter.createActionEvent(TelemetryViews.CreateAzureFunctionWithSqlBinding, TelemetryActions.finishCreateAzureFunctionWithSqlBinding)
@@ -271,7 +271,7 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
.withConnectionInfo(connectionInfo).send();
} catch (error) {
let errorType = utils.getErrorType(error);
propertyBag.telemetryStep = telemetryStep;
propertyBag.telemetryStep = telemetryStep ?? '';
// an error occurred during createFunction
exitReason = ExitReason.error;
void vscode.window.showErrorMessage(constants.errorNewAzureFunction(error));
@@ -279,7 +279,7 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
.withAdditionalProperties(propertyBag).send();
return;
} finally {
propertyBag.telemetryStep = telemetryStep;
propertyBag.telemetryStep = telemetryStep ?? '';
propertyBag.exitReason = exitReason;
TelemetryReporter.createActionEvent(TelemetryViews.CreateAzureFunctionWithSqlBinding, TelemetryActions.exitCreateAzureFunctionQuickpick)
.withAdditionalProperties(propertyBag).send();