Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Instrument applications with Azure Application Insights for telemetry, tracing, and performance monitoring
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: appinsights-instrumentation3description: "Guidance for instrumenting webapps with Azure Application Insights. Provides telemetry patterns, SDK setup, and configuration references. WHEN: how to instrument app, App Insights SDK, telemetry patterns, what is App Insights, Application Insights guidance, instrumentation examples, APM best practices."4license: MIT5metadata:6author: Microsoft7version: "0.0.0-placeholder"8---910# AppInsights Instrumentation Guide1112This skill provides **guidance and reference material** for instrumenting webapps with Azure Application Insights.1314> **⛔ ADDING COMPONENTS?**15>16> If the user wants to **add App Insights to their app**, invoke **azure-prepare** instead.17> This skill provides reference material—azure-prepare orchestrates the actual changes.1819## When to Use This Skill2021- User asks **how** to instrument (guidance, patterns, examples)22- User needs SDK setup instructions23- azure-prepare invokes this skill during research phase24- User wants to understand App Insights concepts2526## When to Use azure-prepare Instead2728- User says "add telemetry to my app"29- User says "add App Insights"30- User wants to modify their project31- Any request to change/add components3233## Prerequisites3435The app in the workspace must be one of these kinds3637- An ASP.NET Core app hosted in Azure38- A Node.js app hosted in Azure3940## Guidelines4142### Collect context information4344Find 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.).4546### Prefer auto-instrument if possible4748If the app is a C# ASP.NET Core app hosted in Azure App Service, use [AUTO guide](references/auto.md) to help user auto-instrument the app.4950### Manually instrument5152Manually instrument the app by creating the AppInsights resource and update the app's code.5354#### Create AppInsights resource5556Use one of the following options that fits the environment.5758- 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.59- Use Azure CLI. See [scripts/appinsights.ps1](scripts/appinsights.ps1) for what Azure CLI command to execute to create the App Insights resource.6061No 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.6263#### Modify application code6465- If the app is an ASP.NET Core app, see [ASPNETCORE guide](references/aspnetcore.md) for how to modify the C# code.66- If the app is a Node.js app, see [NODEJS guide](references/nodejs.md) for how to modify the JavaScript/TypeScript code.67- If the app is a Python app, see [PYTHON guide](references/python.md) for how to modify the Python code.6869## SDK Quick References7071- **OpenTelemetry Distro**: [Python](references/sdk/azure-monitor-opentelemetry-py.md) | [TypeScript](references/sdk/azure-monitor-opentelemetry-ts.md)72- **OpenTelemetry Exporter**: [Python](references/sdk/azure-monitor-opentelemetry-exporter-py.md) | [Java](references/sdk/azure-monitor-opentelemetry-exporter-java.md)7374## Platform-Specific Guides7576- **Container Apps**: [Observability Guide](references/container-apps.md)77