From a5a365b19bb92fe5214b70775c2696f6ccfbbceb Mon Sep 17 00:00:00 2001 From: Chunan Ye Date: Mon, 29 Dec 2025 11:35:34 -0800 Subject: [PATCH] Address copilot feedback --- skills/appinsights-instrumentation/ASPNETCORE.md | 2 +- skills/appinsights-instrumentation/AUTO.md | 2 +- skills/appinsights-instrumentation/NODEJS.md | 2 +- skills/appinsights-instrumentation/PYTHON.md | 4 ++-- skills/appinsights-instrumentation/SKILL.md | 14 +++++++------- .../examples/appinsights.bicep | 2 +- .../scripts/appinsights.ps1 | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/skills/appinsights-instrumentation/ASPNETCORE.md b/skills/appinsights-instrumentation/ASPNETCORE.md index 6f0caa38..6a61bc46 100644 --- a/skills/appinsights-instrumentation/ASPNETCORE.md +++ b/skills/appinsights-instrumentation/ASPNETCORE.md @@ -8,7 +8,7 @@ dotnet add package Azure.Monitor.OpenTelemetry.AspNetCore ``` - Configure the app to use Azure Monitor -An AspNetCore app typically has a Program.cs file that "builds" the app. Find this file and apply these changes. +An ASP.NET Core app typically has a Program.cs file that "builds" the app. Find this file and apply these changes. - Add `using Azure.Monitor.OpenTelemetry.AspNetCore;` at the top - Before calling `builder.Build()`, add this line `builder.Services.AddOpenTelemetry().UseAzureMonitor();`. diff --git a/skills/appinsights-instrumentation/AUTO.md b/skills/appinsights-instrumentation/AUTO.md index 81d9f9e4..40890f42 100644 --- a/skills/appinsights-instrumentation/AUTO.md +++ b/skills/appinsights-instrumentation/AUTO.md @@ -2,7 +2,7 @@ Use Azure Portal to auto-instrument a webapp hosted in Azure App Service for App Insights without making any code changes. Only the following types of app can be auto-instrumented. See [supported environments and resource providers](https://learn.microsoft.com/azure/azure-monitor/app/codeless-overview#supported-environments-languages-and-resource-providers). -- AspNetCore app hosted in Azure App Service +- ASP.NET Core app hosted in Azure App Service - Node.js app hosted in Azure App Service Construct a url to bring the user to the Application Insights blade in Azure Portal for the App Service App. diff --git a/skills/appinsights-instrumentation/NODEJS.md b/skills/appinsights-instrumentation/NODEJS.md index d67299dd..f67690fb 100644 --- a/skills/appinsights-instrumentation/NODEJS.md +++ b/skills/appinsights-instrumentation/NODEJS.md @@ -8,7 +8,7 @@ npm install @azure/monitor-opentelemetry ``` - Configure the app to use Azure Monitor -An nodjs app typically has an entry file that is listed as the "main" property in package.json. Find this file and apply these changes in it. +A Node.js app typically has an entry file that is listed as the "main" property in package.json. Find this file and apply these changes in it. - Require the client library at the top. `const { useAzureMonitor } = require("@azure/monitor-opentelemetry");` - Call the setup method. `useAzureMonitor();` diff --git a/skills/appinsights-instrumentation/PYTHON.md b/skills/appinsights-instrumentation/PYTHON.md index 98e6fced..3bb44c4b 100644 --- a/skills/appinsights-instrumentation/PYTHON.md +++ b/skills/appinsights-instrumentation/PYTHON.md @@ -8,7 +8,7 @@ pip install azure-monitor-opentelemetry ``` - Configure the app to use Azure Monitor -Python applications send telemtry via the logger class in Python standard library. Create a module that configures and creates a logger that can send telemetry. +Python applications send telemetry via the logger class in Python standard library. Create a module that configures and creates a logger that can send telemetry. ```python import logging @@ -17,7 +17,7 @@ from azure.monitor.opentelemetry import configure_azure_monitor configure_azure_monitor( logger_name="" ) -logger = logging.getLogger("") ``` > Note: since we modified the code of the app, it needs to be deployed to take effect. diff --git a/skills/appinsights-instrumentation/SKILL.md b/skills/appinsights-instrumentation/SKILL.md index 8273eebe..8db62114 100644 --- a/skills/appinsights-instrumentation/SKILL.md +++ b/skills/appinsights-instrumentation/SKILL.md @@ -1,6 +1,6 @@ --- name: appinsights-instrumentation -description: Instrument a webapp to send useful telemetry data to Azure App Insights +description: 'Instrument a webapp to send useful telemetry data to Azure App Insights' --- # AppInsights instrumentation @@ -15,8 +15,8 @@ Use this skill when the user wants to enable telemetry for their webapp. The app in the workspace must be one of these kinds -- An AspNetCore app hosted in Azure -- A NodeJS app hosted in Azure +- An ASP.NET Core app hosted in Azure +- A Node.js app hosted in Azure ## Guidelines @@ -26,7 +26,7 @@ Find out the (programming language, application framework, hosting) tuple of the ### Prefer auto-instrument if possible -If the app is a C# AspNetCore app hosted in Azure App Service, use [AUTO.md](AUTO.md) to help user auto-instrument the app. +If the app is a C# ASP.NET Core app hosted in Azure App Service, use [AUTO.md](AUTO.md) to help user auto-instrument the app. ### Manually instrument @@ -37,12 +37,12 @@ Manually instrument the app by creating the AppInsights resource and update the Use one of the following options that fits the environment. - Add AppInsights to existing Bicep template. See [examples/appinsights.bicep](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/create-appinsights.ps1](scripts/create-appinsights.ps1) for what Azure CLI command to execute to create the App Insights resource. +- Use Azure CLI. See [scripts/appinsights.ps1](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. #### Modify application code -- If the app is an AspNetCore app, see [ASPNETCORE.md](ASPNETCORE.md) for how to modify the C# code. -- If the app is a NodeJS app, see [NODEJS.md](NODEJS.md) for how to modify the JavaScript/TypeScript code. +- If the app is an ASP.NET Core app, see [ASPNETCORE.md](ASPNETCORE.md) for how to modify the C# code. +- If the app is a Node.js app, see [NODEJS.md](NODEJS.md) for how to modify the JavaScript/TypeScript code. - If the app is a Python app, see [PYTHON.md](PYTHON.md) for how to modify the Python code. diff --git a/skills/appinsights-instrumentation/examples/appinsights.bicep b/skills/appinsights-instrumentation/examples/appinsights.bicep index 192d988c..e60ea800 100644 --- a/skills/appinsights-instrumentation/examples/appinsights.bicep +++ b/skills/appinsights-instrumentation/examples/appinsights.bicep @@ -27,4 +27,4 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = { } } -output connectionString string = applicationInsights.?properties.ConnectionString +output connectionString string = applicationInsights.properties.ConnectionString diff --git a/skills/appinsights-instrumentation/scripts/appinsights.ps1 b/skills/appinsights-instrumentation/scripts/appinsights.ps1 index 9b70c59f..e014cf0c 100644 --- a/skills/appinsights-instrumentation/scripts/appinsights.ps1 +++ b/skills/appinsights-instrumentation/scripts/appinsights.ps1 @@ -10,11 +10,11 @@ az monitor app-insights component create --app $applicationInsightsResourceName az monitor app-insights component show --app $applicationInsightsResourceName --resource-group $resourceGroupName --query connectionString --output tsv # Set environment variable of App Service -az webapp config appsettings set --resource-group $resourceGroup --name $appName --settings $key='$value' +az webapp config appsettings set --resource-group $resourceGroupName --name $appName --settings $key=$value # Set environment variable of Container App # Or update an existing container app az containerapp update -n $containerAppName -g $resourceGroupName --set-env-vars $key=$value # Set environment variable of Function App -az functionapp config appsettings set --name $functionName --resource-group $myResourceGroup --settings $key=$value +az functionapp config appsettings set --name $functionName --resource-group $ResourceGroupName --settings $key=$value