Skip to content

Commit b17c7e8

Browse files
authored
Ensure durable storage type telemetry is set in all workflows (#4656)
1 parent bc90b46 commit b17c7e8

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/commands/createFunction/createFunction.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ export async function createFunctionInternal(context: IActionContext, options: a
7171
}
7272

7373
const { language, languageModel, version, templateSchemaVersion } = await verifyInitForVSCode(context, projectPath, options.language, options.languageModel, options.version);
74-
const hasDurableStorage: boolean = await durableUtils.verifyHasDurableStorage(language, projectPath);
74+
const durableStorageType = await durableUtils.getStorageTypeFromWorkspace(language, projectPath);
75+
context.telemetry.properties.hasDurableStorageProject = String(!!durableStorageType);
76+
context.telemetry.properties.durableStorageType = durableStorageType;
7577

7678
const projectTemplateKey: string | undefined = getWorkspaceSetting(projectTemplateKeySetting, projectPath);
7779
const wizardContext: IFunctionWizardContext = Object.assign(context, options, await createActivityContext(),
78-
{ projectPath, workspacePath, workspaceFolder, version, language, languageModel, projectTemplateKey, hasDurableStorage, templateSchemaVersion });
80+
{ projectPath, workspacePath, workspaceFolder, version, language, languageModel, projectTemplateKey, hasDurableStorage: !!durableStorageType, templateSchemaVersion });
7981
wizardContext.activityTitle = localize('creatingFunction', 'Create function');
8082
wizardContext.activityChildren = [];
8183

src/commands/createFunction/durableSteps/DurableStorageTypePromptStep.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ export class DurableStorageTypePromptStep<T extends IFunctionWizardContext> exte
3636
await openUrl('https://aka.ms/durable-storage-providers');
3737
}
3838
}
39+
3940
context.newDurableStorageType = pick;
41+
context.telemetry.properties.durableStorageType = pick;
4042
}
4143

4244
public shouldPrompt(context: T): boolean {

src/commands/createFunctionApp/FunctionAppHostingPlanStep.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { createHttpHeaders, createPipelineRequest } from '@azure/core-rest-pipel
88
import { setLocationsTask, WebsiteOS, type IAppServiceWizardContext } from '@microsoft/vscode-azext-azureappservice';
99
import { createGenericClient, LocationListStep, type AzExtPipelineResponse, type AzExtRequestPrepareOptions } from '@microsoft/vscode-azext-azureutils';
1010
import { AzureWizardPromptStep, type IAzureQuickPickItem } from '@microsoft/vscode-azext-utils';
11+
import { DurableBackend } from '../../constants';
1112
import { localize } from '../../localize';
1213
import { getRandomHexString } from '../../utils/fs';
1314
import { nonNullProp } from '../../utils/nonNull';
@@ -38,7 +39,7 @@ export class FunctionAppHostingPlanStep extends AzureWizardPromptStep<IFunctionA
3839
}
3940

4041
public configureBeforePrompt(context: IFunctionAppWizardContext): void | Promise<void> {
41-
if (context.hasDurableTaskScheduler) {
42+
if (context.durableStorageType === DurableBackend.DTS) {
4243
// premium is required for DTS
4344
if (context.advancedCreation) {
4445
// allows users to select/create a Elastic Premium plan

src/commands/createFunctionApp/IFunctionAppWizardContext.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ export interface IFunctionAppWizardContext extends IAppServiceWizardContext, ICr
2626
durableStorageType?: DurableBackend;
2727
useFlexConsumptionPlan?: boolean;
2828
useManagedIdentity?: boolean;
29-
30-
// Detected local connection string
31-
hasAzureStorageConnection?: boolean;
32-
hasEventHubsConnection?: boolean;
33-
hasSqlDbConnection?: boolean;
34-
hasDurableTaskScheduler?: boolean;
3529
}
3630

3731
export interface IFlexFunctionAppWizardContext extends IFunctionAppWizardContext {

src/commands/createFunctionApp/createCreateFunctionAppComponents.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AppInsightsCreateStep, AppInsightsListStep, AppKind, AppServicePlanCrea
77
import { CommonRoleDefinitions, createRoleId, LocationListStep, ResourceGroupCreateStep, ResourceGroupListStep, RoleAssignmentExecuteStep, StorageAccountCreateStep, StorageAccountKind, StorageAccountListStep, StorageAccountPerformance, StorageAccountReplication, type INewStorageAccountDefaults, type Role } from "@microsoft/vscode-azext-azureutils";
88
import { type AzureWizardExecuteStep, type AzureWizardPromptStep, type ISubscriptionContext } from "@microsoft/vscode-azext-utils";
99
import { FuncVersion, latestGAVersion, tryParseFuncVersion } from "../../FuncVersion";
10-
import { DurableBackend, funcVersionSetting } from "../../constants";
10+
import { funcVersionSetting } from "../../constants";
1111
import { tryGetLocalFuncVersion } from "../../funcCoreTools/tryGetLocalFuncVersion";
1212
import { type ICreateFunctionAppContext } from "../../tree/SubscriptionTreeItem";
1313
import { createActivityContext } from "../../utils/activityUtils";
@@ -55,7 +55,8 @@ export async function createCreateFunctionAppComponents(context: ICreateFunction
5555

5656
await detectDockerfile(context);
5757
if (wizardContext.workspaceFolder) {
58-
wizardContext.hasDurableTaskScheduler = await durableUtils.getStorageTypeFromWorkspace(language, wizardContext.workspaceFolder.uri.fsPath) === DurableBackend.DTS;
58+
wizardContext.durableStorageType = await durableUtils.getStorageTypeFromWorkspace(language, wizardContext.workspaceFolder.uri.fsPath);
59+
wizardContext.telemetry.properties.durableStorageType = wizardContext.durableStorageType;
5960
}
6061

6162
promptSteps.push(new SiteNameStep(context.dockerfilePath ? "containerizedFunctionApp" : "functionApp"));

0 commit comments

Comments
 (0)