对 Azure 云服务启用 Profiler

可通过启用 Application Insights Profiler 来接收 Azure 云服务实例的性能跟踪。 Profiler 通过 Azure 诊断扩展安装在 Azure 云服务的实例上。

本指南介绍如何:

  • 使 Azure 云服务实例能够将诊断数据发送到 Application Insights。
  • 在解决方案中配置 Azure 诊断扩展以安装 Profiler。
  • 部署服务并生成流量以查看 Profiler 跟踪。

先决条件

使用 Application Insights 跟踪请求

将 Azure 云服务实例发布到 Azure 门户时,将 Application Insights SDK 添加到 Azure 云服务

Screenshot that shows the checkbox for sending information to Application Insights.

添加 SDK 并将 Azure 云服务实例发布到 Azure 门户后,使用 Application Insights 跟踪请求:

配置 Azure 诊断扩展

找到应用程序角色的 Azure 诊断 diagnostics.wadcfgx 文件。

Screenshot that shows the diagnostics file in the Azure Cloud Services solution explorer.

添加以下 SinksConfig 部分作为 WadCfg 的子元素:

<WadCfg>
  <DiagnosticMonitorConfiguration>...</DiagnosticMonitorConfiguration>
  <SinksConfig>
    <Sink name="MyApplicationInsightsProfiler">
      <!-- Replace with your own Application Insights instrumentation key. -->
      <ApplicationInsightsProfiler>00000000-0000-0000-0000-000000000000</ApplicationInsightsProfiler>
    </Sink>
  </SinksConfig>
</WadCfg>

注意

应用程序和 ApplicationInsightsProfiler 接收器使用的检测密钥必须匹配。

使用新的诊断配置部署服务。 Application Insights Profiler 现已配置为在你的 Azure 云服务实例上运行。

后续步骤

注意

对检测密钥引入的支持将于 2025 年 3 月 31 日结束。 检测密钥引入功能将会继续工作,但我们将不再为该功能提供更新或支持。 转换为连接字符串,以利用新功能