Skip to content

Commit d93eab8

Browse files
authored
Create a centralized CommandAttributes and add attributes for DTS setup (#4649)
1 parent 9eee761 commit d93eab8

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
lines changed

src/commands/CommandAttributes.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import { type ActivityAttributes } from "@microsoft/vscode-azext-utils";
7+
8+
export class CommandAttributes {
9+
10+
static readonly Deploy: ActivityAttributes = {
11+
description: "Deploys application code to an Azure Functions app using deployment methods such as zip deployment, Azure CLI, or GitHub Actions. This action publishes the app to the specified Function App resource, making it live in the target environment.",
12+
troubleshooting: [
13+
"Deployment succeeds but the app fails to start — check Application Insights or log stream for runtime errors.",
14+
"Deployment fails due to '403 Forbidden' or '401 Unauthorized' — verify the publishing profile, service principal, or deployment credentials have appropriate permissions.",
15+
"Code changes are not reflected — ensure you're not deploying to a staging slot or that deployment caching isn't interfering.",
16+
"Missing or invalid host.json or function.json — validate your app's structure and configuration files.",
17+
"Dependencies not installed — make sure your build step restores packages before deployment (e.g., npm install, pip install).",
18+
"Cold start latency after deployment — this is normal for Consumption Plan apps and usually resolves after the first few executions.",
19+
"Function runtime version mismatch — verify the target runtime version in Azure matches your local dev/runtime settings.",
20+
"Zip deployment fails with 'conflicting changes' — ensure no simultaneous deployments or file locks are interfering.",
21+
"Continuous deployment stuck or outdated — check your deployment center logs for GitHub/DevOps pipeline issues.",
22+
"App Service Plan quota exceeded — check if the Function App’s resource usage has hit limits for memory, CPU, or file system.",
23+
],
24+
};
25+
26+
static readonly DeployDTSSetup: ActivityAttributes = {
27+
description: "A preflight operation that ensures that a new Durable Task Scheduler (DTS) resource and hub is created, configured, and ready for connection to the function app.",
28+
troubleshooting: [
29+
"DTS resource creation takes a long time (25+ minutes) and then fails - possible temporary service issue; you should recommend that the user try again a short time later and delete any unused resources that were created.",
30+
"Task hub creation fails — if an existing parent DTS resource was selected, check that the scheduler is not stuck in a provisioning state.",
31+
],
32+
};
33+
34+
}

src/commands/appSettings/connectionSettings/durableTaskScheduler/getDTSConnection.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ext } from "../../../../extensionVariables";
1313
import { localize } from "../../../../localize";
1414
import { HttpDurableTaskSchedulerClient, type DurableTaskSchedulerResource } from "../../../../tree/durableTaskScheduler/DurableTaskSchedulerClient";
1515
import { createActivityContext } from "../../../../utils/activityUtils";
16+
import { CommandAttributes } from "../../../CommandAttributes";
1617
import { type IFuncDeployContext } from "../../../deploy/deploy";
1718
import { type IDTSConnectionSetSettingsContext } from "../ISetConnectionSettingContext";
1819
import { DTSConnectionListStep } from "./DTSConnectionListStep";
@@ -47,6 +48,8 @@ export async function getDTSConnectionIfNeeded(context: DTSConnectionContext, ap
4748
const wizardContext: IDTSAzureConnectionWizardContext = {
4849
...context,
4950
...await createActivityContext({ withChildren: true }),
51+
activityAttributes: CommandAttributes.DeployDTSSetup,
52+
callbackId: `${context.callbackId}.dtsSetup`,
5053
site,
5154
projectPath,
5255
action: CodeAction.Deploy,

src/commands/deploy/deploy.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { isPathEqual } from '../../utils/fs';
2424
import { treeUtils } from '../../utils/treeUtils';
2525
import { getWorkspaceSetting } from '../../vsCodeConfig/settings';
2626
import { verifyInitForVSCode } from '../../vsCodeConfig/verifyInitForVSCode';
27+
import { CommandAttributes } from '../CommandAttributes';
2728
import { type ISetConnectionSettingContext } from '../appSettings/connectionSettings/ISetConnectionSettingContext';
2829
import { getStorageConnectionIfNeeded } from '../appSettings/connectionSettings/azureWebJobsStorage/getStorageConnection';
2930
import { getDTSConnectionIfNeeded } from '../appSettings/connectionSettings/durableTaskScheduler/getDTSConnection';
@@ -68,25 +69,11 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
6869
}
6970

7071
const context: IFuncDeployContext = Object.assign(actionContext, deployPaths, {
72+
...await createActivityContext(),
73+
activityAttributes: CommandAttributes.Deploy,
7174
action: CodeAction.Deploy,
7275
defaultAppSetting: 'defaultFunctionAppToDeploy',
7376
projectPath,
74-
activityAttributes: {
75-
"description": "Deploys application code to an Azure Functions app using deployment methods such as zip deployment, Azure CLI, or GitHub Actions. This action publishes the app to the specified Function App resource, making it live in the target environment.",
76-
"troubleshooting": [
77-
"Deployment succeeds but the app fails to start — check Application Insights or log stream for runtime errors.",
78-
"Deployment fails due to '403 Forbidden' or '401 Unauthorized' — verify the publishing profile, service principal, or deployment credentials have appropriate permissions.",
79-
"Code changes are not reflected — ensure you're not deploying to a staging slot or that deployment caching isn't interfering.",
80-
"Missing or invalid host.json or function.json — validate your app's structure and configuration files.",
81-
"Dependencies not installed — make sure your build step restores packages before deployment (e.g., npm install, pip install).",
82-
"Cold start latency after deployment — this is normal for Consumption Plan apps and usually resolves after the first few executions.",
83-
"Function runtime version mismatch — verify the target runtime version in Azure matches your local dev/runtime settings.",
84-
"Zip deployment fails with 'conflicting changes' — ensure no simultaneous deployments or file locks are interfering.",
85-
"Continuous deployment stuck or outdated — check your deployment center logs for GitHub/DevOps pipeline issues.",
86-
"App Service Plan quota exceeded — check if the Function App’s resource usage has hit limits for memory, CPU, or file system."
87-
]
88-
},
89-
...(await createActivityContext())
9077
});
9178

9279
if (treeUtils.isAzExtTreeItem(arg1)) {

0 commit comments

Comments
 (0)