为应用添加监控埋点

监控与排障 Azure 解决方案

Ebadur Osib

Senior Cloud Consulting Engineer

埋点 vs Application Insights

埋点 vs Application Insights

监控与排障 Azure 解决方案

为应用添加监控埋点

无数据

监控与排障 Azure 解决方案

埋点

疑问的应用

已连接的应用

监控与排障 Azure 解决方案

什么是应用埋点?

应用发出遥测

 

  • 添加监控代码。
  • 启用遥测采集:
    • 请求率
    • 响应时间
    • 错误
    • 依赖
  • 将数据发送到 Azure Monitor 和 Application Insights。
监控与排障 Azure 解决方案

自动埋点

 

  • 支持常见 Azure 服务:
    • 应用服务
    • Azure Functions
  • 配置最少。
  • 无需手动改代码。

  已启用 Insights

监控与排障 Azure 解决方案

自动埋点实战

自动埋点演示

监控与排障 Azure 解决方案

Azure 自动注入的内容

分层示意图

 

  • 将 Application Insights 代理注入运行时。
  • 代理利用运行时级 SDK 挂钩。
  • 自动发送遥测。
  • 无需显式引用 SDK。
监控与排障 Azure 解决方案

静默失败

静默失败

监控与排障 Azure 解决方案

静默失败

静默失败 1

静默失败 2

监控与排障 Azure 解决方案

手动埋点

 

  • 将 SDK 添加到应用代码。
  • 控制力更强。
  • 自定义遥测用于:
    • 事件
    • 业务指标
    • 详细跟踪

代码片段

监控与排障 Azure 解决方案

密钥与连接

  • 遥测需要目标位置。
  • 由连接字符串定义。
  • 自动埋点会自动配置。
  • 手动埋点需显式指定位置。
  • 遥测必需。

连接字符串

监控与排障 Azure 解决方案

环境变量

环境变量

监控与排障 Azure 解决方案

故障排查

 

  • 确认已启用 Application Insights。
  • 使用正确的连接字符串。
  • 运行时与服务受支持。
  • 无冲突的 SDK 配置。

检查清单

监控与排障 Azure 解决方案

总结

总结

 

  • 埋点让应用可观测。
  • 自动埋点无需改代码。
  • 在平台层启用。
  • 使用基于环境的配置。
  • 提供快速且一致的可见性。
  • 是深度监控的基础。
监控与排障 Azure 解决方案

Passons à la pratique !

监控与排障 Azure 解决方案

Preparing Video For Download...