Share via


針對 Azure 雲端服務啟用 Profiler

您可以啟用 Application Insights Profiler,以接收 Azure 雲端服務的執行個體效能追蹤。 會透過 Azure 診斷擴充功能將分析工具安裝在 Azure 雲端服務的執行個體。

在本指南中,您將了解如何:

  • 啟用 Azure 雲端服務的執行個體,以將診斷資料傳送至 Application Insights。
  • 在您的解決方案中設定 Azure 診斷擴充功能,以安裝分析工具。
  • 部署您的服務並產生流量,以檢視分析工具追蹤。

必要條件

使用 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 日結束。 檢測金鑰擷取將會繼續運作,但我們不再提供該功能的更新或支援。 轉換至連接字串以利用新功能