본문으로 건너뛰기
Skillpedia
머신러닝48k · #3967

azure-monitor-opentelemetry-py

하는 일

이 도구는 Azure Application Insights로 Python 애플리케이션의 모니터링을 설정하는 데 도움을 줍니다. 오류와 성능처럼 코드에서 일어나는 일을 자동으로 확인할 수 있습니다.

사용하는 경우

  • ✓Python 애플리케이션의 성능을 확인하고 싶을 때.
  • ✓애플리케이션의 오류를 찾아 고치고 싶을 때.
  • ✓새 애플리케이션을 출시하고 사용량을 모니터링하고 싶을 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-monitor-opentelemetry-py/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-monitor-opentelemetry-py/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 Python 애플리케이션을 Azure Application Insights로 모니터링하도록 설정해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

Python 프로그램의 시작 부분에 Azure에 연결하는 한 줄의 코드를 추가합니다. 이 줄은 도구가 애플리케이션의 사용 현황과 오류 정보를 자동으로 수집하도록 지시합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Azure Monitor OpenTelemetry Distro for Python

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

Installation

pip install azure-monitor-opentelemetry

Environment Variables

APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/

Quick Start

from azure.monitor.opentelemetry import configure_azure_monitor

# One-line setup - reads connection string from environment
configure_azure_monitor()

# Your application code...

Explicit Configuration

from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor(
    connection_string="InstrumentationKey=xxx;IngestionEndpoint=https://xxx.in.applicationinsights.azure.com/"
)

With Flask

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

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

configure_azure_monitor()

# Django settings...

With FastAPI

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

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

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

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

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:

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

from azure.monitor.opentelemetry import configure_azure_monitor

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

Enable Live Metrics

from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor(
    enable_live_metrics=True
)

Azure AD Authentication

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

configure_azure_monitor(
    credential=DefaultAzureCredential()
)

Auto-Instrumentations Included

Library Telemetry Type
Flask Traces
Django Traces
FastAPI Traces
Requests Traces
urllib3 Traces
httpx Traces
aiohttp Traces
psycopg2 Traces
pymysql Traces
pymongo Traces
redis Traces

Configuration Options

Parameter Description Default
connection_string Application Insights connection string From env var
credential Azure credential for AAD auth None
sampling_ratio Sampling rate (0.0 to 1.0) 1.0
resource OpenTelemetry Resource Auto-detected
instrumentations List of instrumentations to enable All
enable_live_metrics Enable Live Metrics stream False

Best Practices

  1. Call configure_azure_monitor() early — Before importing instrumented libraries
  2. Use environment variables for connection string in production
  3. Set cloud role name for multi-service applications

…

자주 묻는 질문

이 도구는 어떻게 설치하나요?

터미널에서 `pip install azure-monitor-opentelemetry` 명령으로 설치할 수 있습니다.

설정 코드는 어디에 넣나요?

`configure_azure_monitor()` 설정 줄은 가능한 한 코드의 앞부분, 즉 모니터링하려는 다른 라이브러리를 가져오기 전에 두는 것이 권장됩니다.

모든 것을 직접 설정해야 하나요?

아니요, 이 도구가 많은 부분을 자동으로 설정합니다. 데이터를 보낼 위치를 알려 주는 연결 문자열이나 환경 변수만 제공하면 됩니다.

상세 정보

작성자의 원본 설명

Azure Monitor OpenTelemetry Distro for Python. Use for one-line Application Insights setup with auto-instrumentation.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#3967
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬