使用 Application Insights 探查实时 Azure Functions 应用

本文将使用 Azure 门户执行以下操作:

  • 查看 Functions 应用的当前应用设置。
  • 在 Functions 应用上添加两个新应用设置以启用 Profiler。
  • 导航到 Functions 应用的 Profiler 以查看数据。

注意

可以在“应用服务”计划中为 Azure Functions 应用启用 Application Insights Profiler。

先决条件

用于启用 Profiler 的应用设置

应用设置
APPINSIGHTS_PROFILERFEATURE_VERSION 1.0.0
DiagnosticServices_EXTENSION_VERSION ~3
APPINSIGHTS_INSTRUMENTATIONKEY App Insights 资源中的唯一值。

将应用设置添加到 Azure Functions 应用

从 Azure 门户中的 Functions 应用概述页面:

  1. 在“设置”下,选择“配置”。

    Screenshot of selecting Configuration from under the Settings section of the left side menu.

  2. 在“应用程序设置”选项卡中,验证 APPINSIGHTS_INSTRUMENTATIONKEY 设置是否包含在设置列表中。

    Screenshot showing the App Insights Instrumentation Key setting in the list.

  3. 选择“新应用程序设置”。

    Screenshot outlining the new application setting button.

  4. 上面的表中复制应用程序设置及其值,然后粘贴到相应的字段中。

    Screenshot adding the app insights profiler feature version setting.

    Screenshot adding the diagnostic services extension version setting.

    暂时将“部署槽位设置”留空。

  5. 单击" 确定"。

  6. 单击顶部菜单中的“保存”,再单击“继续”。

    Screenshot outlining the save button in the top menu of the configuration pane.

    Screenshot outlining the continue button in the dialog after saving.

应用设置现在显示在表中:

Screenshot showing the two new app settings in the table on the configuration pane.

注意

也可使用以下项来启用 Profiler:

后续步骤

了解如何...