技能 Azure Monitor OpenTelemetry Exporter for Python
📊

Azure Monitor OpenTelemetry Exporter for Python

安全

将OpenTelemetry数据导出到Azure Application Insights

此技能为Claude Code提供关于Azure Monitor OpenTelemetry Exporter for Python的知识,使开发者能够将自定义遥测管道直接发送到Application Insights进行监控和分析。

支持: Claude Codex Code(CC)
📊 70 充足
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“Azure Monitor OpenTelemetry Exporter for Python”。 How do I export traces to Application Insights?

预期结果:

要导出跟踪到Application Insights,请创建AzureMonitorTraceExporter并将其添加到BatchSpanProcessor。使用您的导出器设置跟踪提供者,然后使用跟踪器创建将自动发送到Azure的跨度。

正在使用“Azure Monitor OpenTelemetry Exporter for Python”。 What is the difference between this exporter and the distro?

预期结果:

azure-monitor-opentelemetry-exporter提供用于自定义管道的低级导出器类。azure-monitor-opentelemetry distro包含自动检测和预配置的默认值。当您需要对遥测管道进行细粒度控制时,请使用导出器。

安全审计

安全
v1 • 2/25/2026

This is a documentation-only skill containing only a SKILL.md file with usage examples for the azure-monitor-opentelemetry-exporter Python package. No executable code was scanned. Static analysis found 0 files, 0 lines of code, and 0 security issues. The skill provides legitimate Azure monitoring documentation with no malicious patterns.

0
已扫描文件
0
分析行数
0
发现项
1
审计总数
未发现安全问题
审计者: claude

质量评分

38
架构
100
可维护性
87
内容
32
社区
100
安全
83
规范符合性

你能构建什么

自定义OpenTelemetry管道

为高级监控场景构建具有特定处理器、采样器和导出器的自定义遥测管道

Azure原生监控

将Python应用程序与Azure Application Insights集成,实现企业监控和告警

多服务追踪

通过Application Insights采样在微服务之间实现一致的分布式追踪

试试这些提示

基本跟踪导出
如何设置AzureMonitorTraceExporter将OpenTelemetry跟踪发送到Application Insights?
自定义指标设置
展示如何配置AzureMonitorMetricExporter与自定义meter provider和导出间隔。
日志集成
如何使用BatchLogRecordProcessor将Python日志与AzureMonitorLogExporter集成?
AAD身份验证
配置AzureMonitorTraceExporter使用DefaultAzureCredential进行Azure AD身份验证,而不是使用检测密钥。

最佳实践

  • 在生产环境中使用BatchSpanProcessor而不是SimpleSpanProcessor,以获得更好的性能
  • 启用ApplicationInsightsSampler以确保分布式服务之间的一致性采样
  • 使用Azure AD身份验证(DefaultAzureCredential)而不是检测密钥,以获得更好的安全性

避免

  • 不要在生产环境中使用SimpleSpanProcessor,因为它会在每次导出时阻塞
  • 避免在源代码中硬编码检测密钥 - 请使用环境变量
  • 不要在不了解对遥测可靠性的影响的情况下禁用离线存储

常见问题

azure-monitor-opentelemetry和azure-monitor-opentelemetry-exporter之间有什么区别?
distro包(azure-monitor-opentelemetry)提供自动检测和开箱即用的默认值。导出器包让您对OpenTelemetry管道进行低级控制。
如何在没有检测密钥的情况下进行身份验证?
通过将DefaultAzureCredential等凭据传递给导出器构造函数而不是连接字符串来使用Azure AD身份验证。
我可以将其与主权云一起使用吗?
是的,使用相应的授权(AzureGovernment或AzureChina)配置凭据,并使用主权云连接字符串。
如果Application Insights不可用会发生什么?
启用离线存储(默认)后,遥测数据会存储在本地,并在连接恢复时重试。如果您不需要这种可靠性,请禁用离线存储。
如何一致地采样跟踪?
使用ApplicationInsightsSampler,它可以协调服务调用之间的采样决策,以确保完整的跟踪。
这是否支持所有遥测类型?
是的,有针对跟踪(AzureMonitorMetricExporter)、指标(AzureMonitorMetricExporter)和日志(AzureMonitorLogExporter)的单独导出器。