Use this skill when the user wants to enable telemetry for their webapp.
当用户希望为其Web应用启用遥测功能时,可使用本Skill。
Prerequisites
前提条件
The app in the workspace must be one of these kinds
An ASP.NET Core app hosted in Azure
A Node.js app hosted in Azure
工作区中的应用必须属于以下类型之一:
托管在Azure中的ASP.NET Core应用
托管在Azure中的Node.js应用
Guidelines
操作指南
Collect context information
收集上下文信息
Find out the (programming language, application framework, hosting) tuple of the application the user is trying to add telemetry support in. This determines how the application can be instrumented. Read the source code to make an educated guess. Confirm with the user on anything you don't know. You must always ask the user where the application is hosted (e.g. on a personal computer, in an Azure App Service as code, in an Azure App Service as container, in an Azure Container App, etc.).
If the app is a C# ASP.NET Core app hosted in Azure App Service, use AUTO guide to help user auto-instrument the app.
如果应用是托管在Azure App Service中的C# ASP.NET Core应用,请使用AUTO指南帮助用户完成应用的自动检测。
Manually instrument
手动检测
Manually instrument the app by creating the AppInsights resource and update the app's code.
通过创建AppInsights资源并更新应用代码来手动检测应用。
Create AppInsights resource
创建AppInsights资源
Use one of the following options that fits the environment.
Add AppInsights to existing Bicep template. See examples/appinsights.bicep for what to add. This is the best option if there are existing Bicep template files in the workspace.
Use Azure CLI. See scripts/appinsights.ps1 for what Azure CLI command to execute to create the App Insights resource.
No matter which option you choose, recommend the user to create the App Insights resource in a meaningful resource group that makes managing resources easier. A good candidate will be the same resource group that contains the resources for the hosted app in Azure.