Official agent skill

Azure Monitor Opentelemetry Py

by microsoft in microsoft/skills

Azure Monitor OpenTelemetry Distro for Python. An agent skill from microsoft/skills.

OfficialMITAuto-check passedDevOps & Cloud

Install Azure Monitor Opentelemetry Py

skills CLI
$ npx skills add microsoft/skills --skill azure-monitor-opentelemetry-py -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/skills azure-monitor-opentelemetry-py --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/plugins/azure-sdk-python/skills/azure-monitor-opentelemetry-py .claude/skills/azure-monitor-opentelemetry-py && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
azure-monitor-opentelemetry-py
GitHub stars
3.1k
Used in
5 other repos
Token cost
~2k tokens
SKILL.md length
349 words
Files
3 (incl. references)
Skills in repo
150
Repo updated
First seen
Licence
MIT

At a glance

Azure Monitor OpenTelemetry Distro for Python. An agent skill from microsoft/skills.

  • Works in 9 steps: Pick sync OR async and stay consistent.… → Call provider.shutdown() / force_flush()… → Call configure_azure_monitor() early —… → …
  • One-line Application Insights setup with auto-instrumentation
  • SKILL.md covers Installation, Environment Variables, Authentication & Lifecycle and Quick Start, plus 16 more sections
  • Calls pip; reaches xxx.in.applicationinsights.azure.com and learn.microsoft.com; needs AZURE_TOKEN_CREDENTIALS

What it does

Azure Monitor Opentelemetry Py is an agent skill from microsoft/skills, published by the product's own GitHub organization. Azure Monitor OpenTelemetry Distro for Python. Use for one-line Application Insights setup with auto-instrumentation. Triggers: "azure-monitor-opentelemetry", "configureazuremonitor", "Application Insights", "OpenTelemetry distro", "auto-instrumentation".

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/capabilities.md` and `references/non-hero-scenarios.md`).

It sits in DevOps & Cloud, covering Observability. It works with Azure Monitor, OpenTelemetry, Python and Microsoft Azure. The repository describes itself as: Skills, MCP servers, Custom Agents, Agents.md for SDKs to ground Coding Agents. The licence is MIT.

When your agent uses it

  • One-line Application Insights setup with auto-instrumentation
  • Tasks that involve Observability

Example prompts

  • “azure-monitor-opentelemetry”
  • “configureazuremonitor”
  • “Application Insights”
  • “/azure-monitor-opentelemetry-py”

Requirements

  • Python 3

Workflow steps

9 steps, taken from the first numbered list in SKILL.md.

  1. Pick sync OR async and stay consistent. Do not mix azure.xxx sync clients with azure.xxx.aio async clients in the same call path. Choose…
  2. Call provider.shutdown() / force_flush() at process exit to flush telemetry — providers are not context managers.
  3. Call configure_azure_monitor() early — Before importing instrumented libraries
  4. Use environment variables for connection string in production
  5. Set cloud role name for multi-service applications
  6. Enable sampling in high-traffic applications
  7. Use structured logging for better log analytics queries
  8. Add custom attributes to spans for better debugging
  9. Use Microsoft Entra authentication for production workloads

What it can do on your machine

Read from SKILL.md and the folder at commit d5741a1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • xxx.in.applicationinsights.azure.com
    • learn.microsoft.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • AZURE_TOKEN_CREDENTIALS

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Azure Monitor Opentelemetry Py loads about 2k tokens when it runs, and up to ~3.5k if it reads all its reference files. Until then it costs about 72 tokens; SKILL.md has 349 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~72
When it runs · the whole SKILL.md, loaded when a task matches
~2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from microsoft/skills at commit d5741a1, republished under its MIT licence (© microsoft). 349 words, ~1,968 tokens.

Download SKILL.mdSave it as .claude/skills/azure-monitor-opentelemetry-py/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
azure-monitor-opentelemetry-py
description
Azure Monitor OpenTelemetry Distro for Python. Use for one-line Application Insights setup with auto-instrumentation. Triggers: "azure-monitor-opentelemetry", "configure_azure_monitor", "Application Insights", "OpenTelemetry distro", "auto-instrumentation".
license
MIT
metadata.author
Microsoft
metadata.version
1.0.0
metadata.package
azure-monitor-opentelemetry

Azure Monitor OpenTelemetry Distro for Python

One-line setup for Application Insights with OpenTelemetry auto-instrumentation.

Installation

bash
pip install azure-monitor-opentelemetry

Environment Variables

bash
APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/  # Required for all auth methods
AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production

Authentication & Lifecycle

🔑 Two rules apply to every code sample below:

  1. Prefer DefaultAzureCredential for ingestion auth when supported. APPLICATIONINSIGHTS_CONNECTION_STRING identifies the target Application Insights resource, and credential=DefaultAzureCredential(...) provides Microsoft Entra authentication.
    • Local dev: DefaultAzureCredential works as-is.
    • Production: set AZURE_TOKEN_CREDENTIALS=prod (or AZURE_TOKEN_CREDENTIALS=<specific_credential>) to constrain the credential chain to production-safe credentials.
  2. Providers are not context managers. Flush and shut down telemetry providers explicitly at process exit so buffers are exported deterministically.

Snippets may abbreviate this setup, but production code should always follow both rules.

Quick Start

python
from azure.identity import DefaultAzureCredential
from azure.monitor.opentelemetry import configure_azure_monitor

# Connection string identifies the App Insights resource (read from APPLICATIONINSIGHTS_CONNECTION_STRING env var).
# DefaultAzureCredential authenticates ingestion via Microsoft Entra ID (preferred over instrumentation-key-only auth).
configure_azure_monitor(
    credential=DefaultAzureCredential(),
)

# Your application code...

Explicit Connection String

Pass the connection string explicitly by reading it from the environment variable. The value includes both InstrumentationKey and IngestionEndpoint.

python
import os
from azure.monitor.opentelemetry import configure_azure_monitor

# Read the full connection string from the environment.
# Format: "InstrumentationKey=<key>;IngestionEndpoint=https://<id>.in.applicationinsights.azure.com/"
connection_string = os.environ["APPLICATIONINSIGHTS_CONNECTION_STRING"]

try:
    configure_azure_monitor(
        connection_string=connection_string,
    )
    # Your application code...
except Exception as exc:
    raise RuntimeError(f"Azure Monitor configuration failed: {exc}") from exc

With Flask

python
from flask import Flask
from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor()

app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello, World!"

if __name__ == "__main__":
    app.run()

With Django

python
# settings.py
from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor()

# Django settings...

With FastAPI

python
from fastapi import FastAPI
from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor()

app = FastAPI()

@app.get("/")
async def root():
    return {"message": "Hello World"}

Custom Traces

python
from opentelemetry import trace
from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor()

tracer = trace.get_tracer(__name__)

with tracer.start_as_current_span("my-operation") as span:
    span.set_attribute("custom.attribute", "value")
    # Do work...

Custom Metrics

python
from opentelemetry import metrics
from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor()

meter = metrics.get_meter(__name__)
counter = meter.create_counter("my_counter")

counter.add(1, {"dimension": "value"})

Custom Logs

python
import logging
from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor()

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

logger.info("This will appear in Application Insights")
logger.error("Errors are captured too", exc_info=True)

Sampling

python
from azure.monitor.opentelemetry import configure_azure_monitor

# Sample 10% of requests
configure_azure_monitor(
    sampling_ratio=0.1
)

Cloud Role Name

Set cloud role name for Application Map:

python
from azure.monitor.opentelemetry import configure_azure_monitor
from opentelemetry.sdk.resources import Resource, SERVICE_NAME

configure_azure_monitor(
    resource=Resource.create({SERVICE_NAME: "my-service-name"})
)

Disable Specific Instrumentations

python
from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor(
    instrumentations=["flask", "requests"]  # Only enable these
)

Enable Live Metrics

python
from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor(
    enable_live_metrics=True
)

Azure AD Authentication

python
from azure.monitor.opentelemetry import configure_azure_monitor
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential

# Local dev: DefaultAzureCredential. In production, set AZURE_TOKEN_CREDENTIALS=prod or use a specific credential.
credential = DefaultAzureCredential()
# Or use a specific credential directly in production:
# See https://learn.microsoft.com/python/api/overview/azure/identity-readme?view=azure-python#credential-classes
# credential = ManagedIdentityCredential()

configure_azure_monitor(
    credential=credential
)

Auto-Instrumentations Included

LibraryTelemetry Type
FlaskTraces
DjangoTraces
FastAPITraces
RequestsTraces
urllib3Traces
httpxTraces
aiohttpTraces
psycopg2Traces
pymysqlTraces
pymongoTraces
redisTraces

Configuration Options

ParameterDescriptionDefault
connection_stringApplication Insights connection stringFrom env var
credentialAzure credential for AAD authNone
sampling_ratioSampling rate (0.0 to 1.0)1.0
resourceOpenTelemetry ResourceAuto-detected
instrumentationsList of instrumentations to enableAll
enable_live_metricsEnable Live Metrics streamFalse

Best Practices

  1. Pick sync OR async and stay consistent. Do not mix azure.xxx sync clients with azure.xxx.aio async clients in the same call path. Choose one mode per module.
  2. Call provider.shutdown() / force_flush() at process exit to flush telemetry — providers are not context managers.
  3. Call configure_azure_monitor() early — Before importing instrumented libraries
  4. Use environment variables for connection string in production
  5. Set cloud role name for multi-service applications
  6. Enable sampling in high-traffic applications
  7. Use structured logging for better log analytics queries
  8. Add custom attributes to spans for better debugging
  9. Use Microsoft Entra authentication for production workloads

Reference Files

FileContents
references/capabilities.mdAdditional non-hero capabilities, operation-group coverage, and production checklists.
references/non-hero-scenarios.mdDedicated non-hero examples for secondary/advanced scenarios.

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .github/plugins/azure-sdk-python/skills/azure-monitor-opentelemetry-py of microsoft/skills.

  • SKILL.md
  • references/capabilities.md
  • references/non-hero-scenarios.md

Open the folder on GitHubat commit d5741a1

Used in 5 other repositories

We found 14 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 5 other GitHub owners. This page covers the copy in microsoft/skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Azure Monitor Opentelemetry Py next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Azure Monitor Opentelemetry Py compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Azure Monitor Opentelemetry Py this skillmicrosoft/skills3.1k5 repos~2kAutomated safety check: PassMIT
Azure Monitor Opentelemetry Exporter Pyaiskillstore/marketplace4334 repos~1.6kAutomated safety check: PassNone
Azure Microsoft OpentelemetryMicrosoftDocs/Agent-Skills776—~555Automated safety check: PassCC-BY-4.0
Agent Kill Switchvivekchand/clawmetry426—~1.1kAutomated safety check: PassMIT
Clawmetry Selfcheckvivekchand/clawmetry426—~515Automated safety check: PassMIT
Logfire Instrumentationbasicmachines-co/basic-memory4.1k—~2.3kAutomated safety check: PassAGPL-3.0

Similar skills

  • Azure Monitor OpenTelemetry Exporter for Python. An agent skill from aiskillstore/marketplace.

    433 GitHub starsUsed in 4 repos~1.6k tokens
    DevOps & CloudAuto-check passed
  • Azure Microsoft Opentelemetry

    MicrosoftDocs/Agent-Skills

    Official

    Expert knowledge for Azure Microsoft Opentelemetry development including configuration.

    776 GitHub stars~555 tokensUpdated 5 days ago
    DevOps & CloudAuto-check passed
  • Agent Kill Switch

    vivekchand/clawmetry

    Give the human an off switch and a cost meter for the coding agents on this machine, using ClawMetry.

    426 GitHub stars~1.1k tokensUpdated 3 days ago
    DevOps & CloudAuto-check passed
  • Clawmetry Selfcheck

    vivekchand/clawmetry

    Read your own agent telemetry from ClawMetry (waste, progress, cost) and act on it before finishing a task.

    426 GitHub stars~515 tokensUpdated 3 days ago
    DevOps & CloudAuto-check passed
  • Logfire Instrumentation

    basicmachines-co/basic-memory

    Adds Pydantic Logfire tracing, logging and metrics to Python, JavaScript or TypeScript and Rust projects, with the correct setup order and library extras.

    4.1k GitHub stars~2.3k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Clawmetry

    vivekchand/clawmetry

    Real-time observability for OpenClaw agents — local dashboard + optional encrypted cloud sync.

    426 GitHub stars~992 tokensUpdated 3 days ago
    DevOps & CloudAuto-check passed

More from microsoft/skills

All 150 skills in this repo
  • Official

    Covers producer, consumer, and checkpoint-store setup for Azure Event Hubs streaming in Python, with Entra ID auth and partition targeting.

    3.1k GitHub starsUsed in 1 repo~2.3k tokens
    Auto-check passed
  • Official

    Builds podcast-style audio narration from text with Azure OpenAI's GPT Realtime Mini over WebSocket, from a Python FastAPI backend to a React player.

    3.1k GitHub starsUsed in 1 repo~947 tokens
    Auto-check passed
  • Frontend UI Dark TS

    microsoft/skills

    Official

    Build dark-themed React applications using Tailwind CSS with custom theming, glassmorphism effects, and Framer Motion animations.

    3.1k GitHub starsUsed in 5 repos~3.6k tokens
    Auto-check passed
  • Pydantic Models Py

    microsoft/skills

    Official

    Create Pydantic models following the multi-model pattern with Base, Create, Update, Response, and InDB variants.

    3.1k GitHub starsUsed in 5 repos~496 tokens
    Auto-check passed
  • Official

    Reference for building on Microsoft Foundry with the azure-ai-projects Python SDK: project clients, versioned agents, evaluations, connections, datasets and indexes.

    3.1k GitHub stars~2.8k tokensUpdated yesterday
    Auto-check passed
  • Skill Creator

    microsoft/skills

    Official

    Guide for creating effective skills for AI coding agents working with Azure SDKs and Microsoft Foundry services.

    3.1k GitHub starsUsed in 5 repos~17k tokens
    Auto-check passed

Categories

Questions about Azure Monitor Opentelemetry Py

What does Azure Monitor Opentelemetry Py do?

Azure Monitor OpenTelemetry Distro for Python. An agent skill from microsoft/skills. Azure Monitor Opentelemetry Py is an agent skill from microsoft/skills, published by the product's own GitHub organization. Azure Monitor OpenTelemetry Distro for Python.

When should I use Azure Monitor Opentelemetry Py?

Azure Monitor Opentelemetry Py fits situations like: one-line Application Insights setup with auto-instrumentation; tasks that involve Observability.

How do I install Azure Monitor Opentelemetry Py in Claude Code?

Run `npx skills add microsoft/skills --skill azure-monitor-opentelemetry-py -a claude-code`. Or copy the skill folder (.github/plugins/azure-sdk-python/skills/azure-monitor-opentelemetry-py in microsoft/skills) into .claude/skills/azure-monitor-opentelemetry-py in your project. Claude Code loads it when a task matches its description.

How do I install Azure Monitor Opentelemetry Py in Codex?

Run `npx skills add microsoft/skills --skill azure-monitor-opentelemetry-py -a codex`. Or copy the skill folder (.github/plugins/azure-sdk-python/skills/azure-monitor-opentelemetry-py in microsoft/skills) into .agents/skills/azure-monitor-opentelemetry-py in your project. Codex loads it when a task matches its description.

Can I use Azure Monitor Opentelemetry Py in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/skills --skill azure-monitor-opentelemetry-py -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/azure-monitor-opentelemetry-py, .gemini/skills/azure-monitor-opentelemetry-py, .github/skills/azure-monitor-opentelemetry-py and .opencode/skills/azure-monitor-opentelemetry-py in your project.

What does Azure Monitor Opentelemetry Py need to run?

Going by SKILL.md and its folder, Azure Monitor Opentelemetry Py needs the command-line tools its instructions call (pip) and credentials named AZURE_TOKEN_CREDENTIALS. Our summary lists: Python 3.

Does Azure Monitor Opentelemetry Py access the network?

SKILL.md names 2 domains. In commands or code: xxx.in.applicationinsights.azure.com and learn.microsoft.com; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is Azure Monitor Opentelemetry Py safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Azure Monitor Opentelemetry Py use?

Azure Monitor Opentelemetry Py is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Azure Monitor Opentelemetry Py use?

About 2k tokens (SKILL.md is roughly 7.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.6k tokens, read only when the agent opens those files.

What are the alternatives to Azure Monitor Opentelemetry Py?

Skills that share tags, products or a category with Azure Monitor Opentelemetry Py: Azure Monitor Opentelemetry Exporter Py (aiskillstore/marketplace, 433 stars), Azure Microsoft Opentelemetry (MicrosoftDocs/Agent-Skills, 776 stars), Agent Kill Switch (vivekchand/clawmetry, 426 stars) and Clawmetry Selfcheck (vivekchand/clawmetry, 426 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Azure Monitor Opentelemetry Py?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/skills, which has 3,097 GitHub stars. The repository holds 150 skills in this directory. The repository was last updated on October 9, 2026.

Source: microsoft/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.