針對 Azure Service Fabric 應用程式啟用 Profiler

Application Insights Profiler 會隨附於 Azure 診斷。 您可以使用 Azure Resource Manager 範本 (ARM 範本) 為 Azure Service Fabric 叢集安裝 Azure 診斷延伸模組。 取得將 Azure 診斷安裝在 Service Fabric 叢集上的範本

在本文章中,您將:

  • 將 Application Insights Profiler 屬性新增至 ARM 範本。
  • 使用 Application Insights Profiler 檢測金鑰部署 Service Fabric 叢集。
  • 在 Service Fabric 應用程式上啟用 Application Insights。
  • 重新部署 Service Fabric 叢集以啟用 Profiler。

必要條件

建立部署範本

  1. 在您的 Service Fabric 受控叢集中,移至您在其中實作 ARM 範本的位置。

  2. 在部署範本檔案的 Azure 診斷延伸模組功能中找出 WadCfg 標籤。

  3. 新增下列 SinksConfig 區段作為 WadCfg 的子元素。 將 ApplicationInsightsProfiler 屬性值取代為您自己的 Application Insights 檢測金鑰:

    "settings": {
        "WadCfg": {
            "SinksConfig": {
                "Sink": [
                    {
                        "name": "MyApplicationInsightsProfilerSinkVMSS",
                        "ApplicationInsightsProfiler": "YOUR_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY"
                    }
                ]
            },
        },
    }  
    

如需如何將診斷延伸模組新增至部署範本的詳細資訊,請參閱搭配 Windows VM 和 Azure Resource Manager 範本使用監視和診斷

部署 Service Fabric 叢集

在您使用檢測金鑰更新 WadCfg 之後,請部署您的 Service Fabric 叢集。

安裝 Azure 診斷延伸模組時,會安裝並啟用 Application Insights Profiler。

在 Service Fabric 應用程式上啟用 Application Insights

若要讓 Profiler 收集要求的設定檔,您的應用程式必須使用 Application Insights 追蹤作業。

在您啟用 Application Insights 之後,請重新部署您的應用程式。

產生流量並檢視 Profiler 追蹤

  1. 啟用可用性測試以產生應用程式的流量。
  2. 等待 10 到 15 分鐘,讓追蹤傳送到 Application Insights 執行個體。
  3. 在 Azure 入口網站中,透過 Application Insights 執行個體檢視 Profiler 追蹤

下一步

注意

針對檢測金鑰擷取的支援將在 2025 年 3 月 31 日結束。 檢測金鑰擷取將會繼續運作,但我們不再提供該功能的更新或支援。 轉換至連接字串以利用新功能