GitHub Copilot ChatGPT Claude Codex CLI Cursor opencode Skill Text

appinsights-instrumentation

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 exampl

Ciza · 0 points · 19 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download microsoft-skills-.github_plugins_azure-skills_skills_appinsights-instrumentation-e58528d.zip · 12 KB
Part of microsoft/skills — 195 skills

Install

skills CLI npx skills add https://github.com/microsoft/skills/tree/main/.github/plugins/azure-skills/skills/appinsights-instrumentation
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install microsoft-skills@llmmart
Git git clone https://github.com/microsoft/skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole microsoft/skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

AppInsights Instrumentation Guide

This skill provides guidance and reference material for instrumenting webapps with Azure Application Insights.

⛔ ADDING COMPONENTS?

If the user wants to add App Insights to their app, invoke azure-prepare instead. This skill provides reference material—azure-prepare orchestrates the actual changes.

When to Use This Skill

  • User asks how to instrument (guidance, patterns, examples)
  • User needs SDK setup instructions
  • azure-prepare invokes this skill during research phase
  • User wants to understand App Insights concepts

When to Use azure-prepare Instead

  • User says "add telemetry to my app"
  • User says "add App Insights"
  • User wants to modify their project
  • Any request to change/add components

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

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.).

Prefer auto-instrument if possible

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.

Manually instrument

Manually instrument the app by creating the AppInsights resource and update the app's code.

Create AppInsights resource

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.

Modify application code

  • If the app is an ASP.NET Core app, see ASPNETCORE guide for how to modify the C# code.
  • If the app is a Node.js app, see NODEJS guide for how to modify the JavaScript/TypeScript code.
  • If the app is a Python app, see PYTHON guide for how to modify the Python code.

SDK Quick References

Platform-Specific Guides

Files (skills)
  • examples
    • appinsights.bicep 759 B · in bundle
  • references
    • sdk
      • azure-monitor-opentelemetry-exporter-java.md 1.1 KB
        # Azure Monitor OpenTelemetry Exporter — Java SDK Quick Reference
        
        > Condensed from **azure-monitor-opentelemetry-exporter-java**. Full patterns
        > (trace/metric/log export, spans, semantic conventions)
        > in the **azure-monitor-opentelemetry-exporter-java** plugin skill if installed.
        
        ## Install
        ```xml
        <dependency>
            <groupId>com.azure</groupId>
            <artifactId>azure-monitor-opentelemetry-exporter</artifactId>
            <version>1.0.0-beta.x</version>
        </dependency>
        ```
        
        > **DEPRECATED**: Migrate to `azure-monitor-opentelemetry-autoconfigure`.
        
        ## Quick Start
        ```java
        // Prefer autoconfigure instead:
        // <artifactId>azure-monitor-opentelemetry-autoconfigure</artifactId>
        ```
        
        ## Best Practices
        - Use autoconfigure — migrate to `azure-monitor-opentelemetry-autoconfigure`
        - Set meaningful span names — use descriptive operation names
        - Add relevant attributes — include contextual data for debugging
        - Handle exceptions — always record exceptions on spans
        - Use semantic conventions — follow OpenTelemetry semantic conventions
        - End spans in finally — ensure spans are always ended
        - Use try-with-resources — scope management with try-with-resources pattern
        
      • azure-monitor-opentelemetry-exporter-py.md 963 B
        # Azure Monitor OpenTelemetry Exporter — Python SDK Quick Reference
        
        > Condensed from **azure-monitor-opentelemetry-exporter-py**. Full patterns
        > (metric exporter, log exporter, offline storage, sovereign clouds)
        > in the **azure-monitor-opentelemetry-exporter-py** plugin skill if installed.
        
        ## Install
        ```bash
        pip install azure-monitor-opentelemetry-exporter
        ```
        
        ## Quick Start
        ```python
        from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
        exporter = AzureMonitorTraceExporter()  # reads APPLICATIONINSIGHTS_CONNECTION_STRING
        ```
        
        ## Best Practices
        - Use BatchSpanProcessor for production (not SimpleSpanProcessor)
        - Use ApplicationInsightsSampler for consistent sampling across services
        - Enable offline storage for reliability in production
        - Use AAD authentication instead of instrumentation keys
        - Set export intervals appropriate for your workload
        - Use the distro (azure-monitor-opentelemetry) unless you need custom pipelines
        
      • azure-monitor-opentelemetry-py.md 880 B
        # Azure Monitor OpenTelemetry — Python SDK Quick Reference
        
        > Condensed from **azure-monitor-opentelemetry-py**. Full patterns
        > (Flask/Django/FastAPI, custom metrics, sampling, live metrics)
        > in the **azure-monitor-opentelemetry-py** plugin skill if installed.
        
        ## Install
        ```bash
        pip install azure-monitor-opentelemetry
        ```
        
        ## Quick Start
        ```python
        from azure.monitor.opentelemetry import configure_azure_monitor
        configure_azure_monitor()
        ```
        
        ## Best Practices
        - Call configure_azure_monitor() early — before importing instrumented libraries
        - Use environment variables for connection string in production
        - Set cloud role name for multi-service Application Map
        - Enable sampling in high-traffic applications
        - Use structured logging for better log analytics queries
        - Add custom attributes to spans for better debugging
        - Use AAD authentication for production workloads
        
      • azure-monitor-opentelemetry-ts.md 986 B
        # Azure Monitor OpenTelemetry — TypeScript SDK Quick Reference
        
        > Condensed from **azure-monitor-opentelemetry-ts**. Full patterns
        > (ESM loader, custom span processors, manual exporters, live metrics)
        > in the **azure-monitor-opentelemetry-ts** plugin skill if installed.
        
        ## Install
        npm install @azure/monitor-opentelemetry
        
        ## Quick Start
        ```typescript
        import { useAzureMonitor } from "@azure/monitor-opentelemetry";
        useAzureMonitor({
          azureMonitorExporterOptions: {
            connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING
          }
        });
        ```
        
        ## Best Practices
        - Call useAzureMonitor() first — before importing other modules
        - Use ESM loader for ESM projects — `--import @azure/monitor-opentelemetry/loader`
        - Enable offline storage for reliable telemetry in disconnected scenarios
        - Set sampling ratio for high-traffic applications
        - Add custom dimensions — use span processors for enrichment
        - Graceful shutdown — call shutdownAzureMonitor() to flush telemetry
        
    • aspnetcore.md 1.7 KB
      ## Modify code
      
      Make these necessary changes to the app.
      
      - Install client library
      ```
      dotnet add package Azure.Monitor.OpenTelemetry.AspNetCore
      ```
      
      - Configure the app to use Azure Monitor
      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();`.
      
      > Note: since we modified the code of the app, the app needs to be deployed to take effect.
      
      ## Configure App Insights connection string
      
      The App Insights resource has a connection string. Add the connection string as an environment variable of the running app. You can use Azure CLI to query the connection string of the App Insights resource. See [scripts/appinsights.ps1](../scripts/appinsights.ps1) for what Azure CLI command to execute for querying the connection string.
      
      After getting the connection string, set this environment variable with its value.
      
      ```
      "APPLICATIONINSIGHTS_CONNECTION_STRING={your_application_insights_connection_string}"
      ```
      
      If the app has IaC template such as Bicep or terraform files representing its cloud instance, this environment variable should be added to the IaC template to be applied in each deployment. Otherwise, use Azure CLI to manually apply the environment variable to the cloud instance of the app. See [scripts/appinsights.ps1](../scripts/appinsights.ps1) for what Azure CLI command to execute for setting this environment variable.
      
      > Important: Don't modify appsettings.json. It was a deprecated way to configure App Insights. The environment variable is the new recommended way.
      
    • auto.md 891 B
      # Auto-instrument app
      
      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).
      
      - 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.
      ```
      https://portal.azure.com/#resource/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Web/sites/{app_service_name}/monitoringSettings
      ```
      
      Use the context or ask the user to get the subscription_id, resource_group_name, and the app_service_name hosting the webapp.
      
    • container-apps.md 7.2 KB
      ## Container Apps Observability
      
      Observability guide for apps running in Azure Container Apps.
      
      ## Environment-Level Log Analytics
      
      By default, Container Apps environments use a Log Analytics workspace. Configure it at environment creation (`--logs-workspace-id` expects the workspace **Customer ID** (GUID), not the ARM resource ID):
      
      ```bash
      WORKSPACE_ID=$(az monitor log-analytics workspace show \
        --resource-group <rg> --workspace-name <workspace-name> \
        --query customerId -o tsv)
      
      WORKSPACE_KEY=$(az monitor log-analytics workspace get-shared-keys \
        --resource-group <rg> --workspace-name <workspace-name> \
        --query primarySharedKey -o tsv)
      
      az containerapp env create \
        --name <env-name> \
        --resource-group <rg> \
        --logs-workspace-id $WORKSPACE_ID \
        --logs-workspace-key $WORKSPACE_KEY \
        --logs-destination log-analytics
      ```
      
      > 💡 **Tip:** All apps in the same environment share the workspace. Use `--logs-destination none` only for BYOB (bring-your-own-backend) scenarios.
      
      ## System Logs vs Application Logs
      
      | Log Table | Content | Retention |
      |-----------|---------|-----------|
      | `ContainerAppConsoleLogs_CL` | stdout/stderr from containers | Workspace default |
      | `ContainerAppSystemLogs_CL` | Platform events (scaling, restarts, image pulls) | Workspace default |
      
      > ⚠️ **Note:** The `_CL` suffix and `_s` column suffixes apply to the **Log Analytics** destination. Environments using the newer **Azure Monitor** destination use `ContainerAppConsoleLogs` / `ContainerAppSystemLogs` (no `_CL`, no `_s` suffixes). Check your environment's log destination to use the correct table name.
      
      System logs capture events outside your code—replica scheduling, health probe results, and revision activation. Console logs capture everything your app writes to stdout/stderr.
      
      ## Built-in Metrics
      
      Container Apps exposes these metrics without any SDK:
      
      | Metric | Description | Dimensions |
      |--------|-------------|-----------|
      | `Replicas` | Current replica count | `revision` |
      | `Requests` | HTTP request count | `statusCode`, `statusCodeCategory`, `revision`, `replica` |
      | `UsageNanoCores` | CPU usage per replica | `revision`, `replica` |
      | `WorkingSetBytes` | Memory usage per replica | `revision`, `replica` |
      | `RestartCount` | Container restart count | `revision`, `replica` |
      | `RxBytes` / `TxBytes` | Network I/O | `revision`, `replica` |
      
      > ⚠️ **Warning:** Built-in metrics cover infrastructure only. For request-level tracing, response times, and dependency tracking, add Application Insights SDK.
      
      ## Application Insights SDK Setup
      
      Set `APPLICATIONINSIGHTS_CONNECTION_STRING` as an environment variable on the container app, then add the SDK per language:
      
      | Language | Package | Init Pattern |
      |----------|---------|-------------|
      | Node.js | `@azure/monitor-opentelemetry` | Call `useAzureMonitor()` before app startup |
      | Python | `azure-monitor-opentelemetry` | Call `configure_azure_monitor()` at entry |
      | .NET | `Azure.Monitor.OpenTelemetry.AspNetCore` | `builder.Services.AddOpenTelemetry().UseAzureMonitor()` |
      | Java | Agent JAR (manual) | Set `JAVA_TOOL_OPTIONS=-javaagent:/agent/applicationinsights-agent.jar` |
      
      ```bash
      # Store as a secret (recommended — keeps value out of az show output and portal config)
      az containerapp secret set -n <app-name> -g <rg> \
        --secrets "appinsights-conn=<conn-string>"
      
      az containerapp update \
        --name <app-name> \
        --resource-group <rg> \
        --set-env-vars "APPLICATIONINSIGHTS_CONNECTION_STRING=secretref:appinsights-conn"
      ```
      
      ## Distributed Tracing Across Microservices
      
      Container Apps with multiple services need correlation. The OpenTelemetry SDK propagates `traceparent` headers automatically through HTTP calls. Ensure:
      
      1. Every microservice has the SDK initialized with the **same** Application Insights resource
      2. HTTP clients use instrumented libraries (e.g., `requests` in Python, `fetch`/`axios` in Node.js)
      3. Verify end-to-end traces in the **Application Map** blade
      
      > 💡 **Tip:** Use `operation_Id` in KQL queries to trace a single request across all services.
      
      ## Dapr Observability
      
      For apps using Dapr sidecars, Dapr generates tracing spans for service invocation, pub/sub, and state operations when tracing is configured. Note that `samplingRate: "1"` means 100% sampling — consider lowering for production workloads.
      
      Configure Dapr tracing in the Container Apps environment. The YAML below represents the config spec — in ACA, apply it via `az containerapp env dapr-component set` or ARM/Bicep (not as a raw YAML file):
      
      ```yaml
      # Dapr tracing config spec (apply via CLI or Bicep, not raw kubectl)
      apiVersion: dapr.io/v1alpha1
      kind: Configuration
      metadata:
        name: appconfig
      spec:
        tracing:
          samplingRate: "1"
          otel:
            endpointAddress: "<otlp-collector-endpoint>"
            isSecure: true
            protocol: grpc
      ```
      
      > ⚠️ **Note:** `endpointAddress` should point to an OpenTelemetry Collector (not Application Insights directly). Configure the collector with the Azure Monitor exporter to forward traces to App Insights.
      
      Dapr generates spans for:
      - **Service invocation** — caller → Dapr sidecar → target sidecar → target app
      - **Pub/sub** — publisher → broker → subscriber
      - **Bindings** — input/output binding operations
      
      ## ARG Queries — Monitoring Status
      
      Discover Container Apps and their monitoring configuration:
      
      ```kql
      // Container Apps without App Insights configured (checks all containers)
      resources
      | where type == "microsoft.app/containerapps"
      | mv-expand container = properties.template.containers
      | mv-expand envVar = container.env
      | where isnotempty(envVar)
      | summarize hasAppInsights = countif(envVar.name == "APPLICATIONINSIGHTS_CONNECTION_STRING") by name, resourceGroup
      | where hasAppInsights == 0
      ```
      
      > **Note:** This query only covers apps with existing environment variables. Apps with no env vars are excluded by the `mv-expand` and should be identified separately (e.g., filter for containers where `env` is null or empty).
      
      ## KQL Query Library
      
      ### Console log errors
      
      ```kql
      ContainerAppConsoleLogs_CL
      | where Log_s contains "error" or Log_s contains "exception"
      | project TimeGenerated, ContainerAppName_s, RevisionName_s, Log_s
      | order by TimeGenerated desc
      | take 50
      ```
      
      ### Replica restart events
      
      ```kql
      ContainerAppSystemLogs_CL
      | where EventSource_s == "ContainerAppController" and Reason_s == "Restarting"
      | summarize restarts = count() by ContainerAppName_s, RevisionName_s, bin(TimeGenerated, 1h)
      | order by TimeGenerated desc
      ```
      
      ### Scaling events
      
      ```kql
      ContainerAppSystemLogs_CL
      | where Reason_s in ("ScalingUp", "ScalingDown")
      | project TimeGenerated, ContainerAppName_s, Reason_s, Log_s
      | order by TimeGenerated desc
      ```
      
      ### Console log volume by revision
      
      ```kql
      ContainerAppConsoleLogs_CL
      | where isnotempty(Log_s)
      | summarize logCount = count() by RevisionName_s, bin(TimeGenerated, 5m)
      | render timechart
      ```
      
      ### Request latency by instance (requires Application Insights SDK)
      
      ```kql
      requests
      | where cloud_RoleName has "<app-name>"
      | summarize avgDuration = avg(duration), p95 = percentile(duration, 95) by cloud_RoleInstance, bin(timestamp, 5m)
      | render timechart
      ```
      
      > 💡 **Tip:** Console logs don't contain latency data. For request-level latency and dependency analysis, query the `requests` and `dependencies` tables from Application Insights.
      
    • nodejs.md 1.8 KB
      ## Modify code
      
      Make these necessary changes to the app.
      
      - Install client library
      ```
      npm install @azure/monitor-opentelemetry
      ```
      
      - Configure the app to use Azure Monitor
      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();`
      
      > Note: The setup method should be called as early as possible but it must be after the environment variables are configured since it needs the App Insights connection string from the environment variable. For example, if the app uses dotenv to load environment variables, the setup method should be called after it but before anything else.
      > Note: since we modified the code of the app, it needs to be deployed to take effect.
      
      ## Configure App Insights connection string
      
      The App Insights resource has a connection string. Add the connection string as an environment variable of the running app. You can use Azure CLI to query the connection string of the App Insights resource. See [scripts/appinsights.ps1] for what Azure CLI command to execute for querying the connection string.
      
      After getting the connection string, set this environment variable with its value.
      
      ```
      "APPLICATIONINSIGHTS_CONNECTION_STRING={your_application_insights_connection_string}"
      ```
      
      If the app has IaC template such as Bicep or terraform files representing its cloud instance, this environment variable should be added to the IaC template to be applied in each deployment. Otherwise, use Azure CLI to manually apply the environment variable to the cloud instance of the app. See what Azure CLI command to execute for setting this environment variable.
      
    • python.md 1.8 KB
      ## Modify code
      
      Make these necessary changes to the app.
      
      - Install client library
      ```
      pip install azure-monitor-opentelemetry
      ```
      
      - Configure the app to use Azure Monitor
      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
      from azure.monitor.opentelemetry import configure_azure_monitor
      
      configure_azure_monitor(
          logger_name="<your_logger_namespace>"
      )
      logger = logging.getLogger("<your_logger_namespace>")
      ```
      
      > Note: since we modified the code of the app, it needs to be deployed to take effect.
      
      ## Configure App Insights connection string
      
      The App Insights resource has a connection string. Add the connection string as an environment variable of the running app. You can use Azure CLI to query the connection string of the App Insights resource. See [scripts/appinsights.ps1] for what Azure CLI command to execute for querying the connection string.
      
      After getting the connection string, set this environment variable with its value.
      
      ```
      "APPLICATIONINSIGHTS_CONNECTION_STRING={your_application_insights_connection_string}"
      ```
      
      If the app has IaC template such as Bicep or terraform files representing its cloud instance, this environment variable should be added to the IaC template to be applied in each deployment. Otherwise, use Azure CLI to manually apply the environment variable to the cloud instance of the app. See what Azure CLI command to execute for setting this environment variable.
      
      ## Send data
      
      Create a logger that is configured to send telemetry.
      ```python
      logger = logging.getLogger("<your_logger_namespace>")
      logger.setLevel(logging.INFO)
      ```
      
      Then send telemetry events by calling its logging methods.
      ```python
      logger.info("info log")
      ```
      
  • scripts
    • appinsights.ps1 1.2 KB · in bundle
  • LICENSE.txt 1.1 KB
    MIT License
    
    Copyright 2025 (c) Microsoft Corporation.
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE
    
  • SKILL.md 3.7 KB
    ---
    name: appinsights-instrumentation
    description: "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."
    license: MIT
    metadata:
      author: Microsoft
      version: "1.2.1"
    ---
    
    # AppInsights Instrumentation Guide
    
    This skill provides **guidance and reference material** for instrumenting webapps with Azure Application Insights.
    
    > **⛔ ADDING COMPONENTS?**
    >
    > If the user wants to **add App Insights to their app**, invoke **azure-prepare** instead.
    > This skill provides reference material—azure-prepare orchestrates the actual changes.
    
    ## When to Use This Skill
    
    - User asks **how** to instrument (guidance, patterns, examples)
    - User needs SDK setup instructions
    - azure-prepare invokes this skill during research phase
    - User wants to understand App Insights concepts
    
    ## When to Use azure-prepare Instead
    
    - User says "add telemetry to my app"
    - User says "add App Insights" 
    - User wants to modify their project
    - Any request to change/add components
    
    ## 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
    
    ## 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.). 
    
    ### Prefer auto-instrument if possible
    
    If 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.
    
    ### Manually instrument
    
    Manually instrument the app by creating the AppInsights resource and update the app's code. 
    
    #### Create AppInsights resource
    
    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/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 ASP.NET Core app, see [ASPNETCORE guide](references/aspnetcore.md) for how to modify the C# code.
    - If the app is a Node.js app, see [NODEJS guide](references/nodejs.md) for how to modify the JavaScript/TypeScript code.
    - If the app is a Python app, see [PYTHON guide](references/python.md) for how to modify the Python code.
    
    ## SDK Quick References
    
    - **OpenTelemetry Distro**: [Python](references/sdk/azure-monitor-opentelemetry-py.md) | [TypeScript](references/sdk/azure-monitor-opentelemetry-ts.md)
    - **OpenTelemetry Exporter**: [Python](references/sdk/azure-monitor-opentelemetry-exporter-py.md) | [Java](references/sdk/azure-monitor-opentelemetry-exporter-java.md)
    
    ## Platform-Specific Guides
    
    - **Container Apps**: [Observability Guide](references/container-apps.md)
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related