監視 Azure 功能服務

若要在 Instana 使用者介面中檢視與 Azure Functions 服務相關的度量值,您需要安裝 Instana 主機代理程式 ,然後啟用 Azure 感應器,如 配置感應器 小節中所述。 在您安裝 Instana 主機代理程式之後,會自動啟用 Azure Functions 感應器。

若要在 Instana 使用者介面中檢視 Azure Functions 追蹤資料,您需要將 Instana Azure Functions 追蹤程式新增至 Azure Functions 應用程式,如 安裝 Instana Azure Functions 追蹤程式 小節中所述。

附註: 如需其他支援的 Azure 服務,請參閱 Azure 文件。

配置

配置感應器

You must enable the Azure sensor in the agent configuration.yaml file <agentinstall_dir>/etc/instana/configuration.yaml`. A minimal sensor configuration looks like as follows:

com.instana.plugin.azure:
  enabled: true
  subscription: "[Your-Subscription-Id]"
  tenant: "[Your-Tenant-Id]"
  principals:
    - id: "[Your-Service-Principal-Account-Id]"
      secret: "[Your-Service-Principal-Secret]"

依預設會啟用 Azure Functions 服務感應器。

選用配置

Azure Functions 感應器可以停用,且可以依標籤和資源群組來過濾。 您可以透過下列方式,使用 <agentinstall_dir>/etc/instana/configuration.yaml 中的代理程式配置來配置 Azure Functions 感應器:

com.instana.plugin.azure.functionapp:
  # Valid values: true, false
  enabled: false # enabled (true) by default
  # Comma separated list of tags in key:value format
  include_tags:
  # Comma separated list of tags in key:value format
  exclude_tags:
  # Comma separated list of resource groups
  include_resource_groups:
  # Comma separated list of resource groups
  exclude_resource_groups:

若要停用監視 Azure 功能服務,請使用下列配置:

com.instana.plugin.azure.functionapp:
  enabled: false

可以定義多個標籤和資源群組,以逗點區隔。 需要以鍵值組形式提供標籤,以冒號 (:) 區隔。 為了使配置更容易,您可以定義要在探索中併入或從探索中排除哪些標籤和資源群組。 如果在兩個清單 (包括及排除) 中定義標籤或資源群組,則排除清單具有較高的優先順序。 如果不需要過濾服務,請不要定義配置。 不一定要定義所有值以啟用過濾。

若要將依標籤的服務併入探索中,請使用下列配置:

com.instana.plugin.azure.functionapp:
  include_tags: # Comma separated list of tags in key:value format (e.g. env:prod,env:staging)

若要從探索中依標籤排除服務,請使用下列配置:

com.instana.plugin.azure.functionapp:
  exclude_tags: # Comma separated list of tags in key:value format (e.g. env:dev,env:test)

若要將依資源群組的服務併入探索,請使用下列配置:

com.instana.plugin.azure.functionapp:
  include_resource_groups: # Comma separated list of resource groups (e.g. rg_prod,rg_staging)

若要依資源群組探索來排除服務,請使用下列配置:

com.instana.plugin.azure.functionapp:
  exclude_resource_groups: # Comma separated list of resource groups (e.g. rg_dev,rg_test)

可以在廣域層次上配置所有 Azure 服務的探索過濾。 如果為 Azure Functions 服務定義過濾器,則會置換廣域過濾器。 如需廣域 Azure 服務探索過濾的詳細資料,請參閱 Azure 配置

安裝 Instana Azure Functions 追蹤器

目前, Instana 與 Azure 功能搭配使用的需求如下:

  • 您的 Azure 功能應用程式是 .NET Core 應用程式。
  • 您的 Azure Function 應用程式是使用 Docker Container 選項部署在 Azure 上。

若要讓 Instana 在 Azure Function 應用程式中運作,請將下列行新增至 Dockerfile:

    DOTNET_STARTUP_HOOKS="[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.dll" \
    CORECLR_ENABLE_PROFILING=1 \
    CORECLR_PROFILER="{cf0d821e-299b-5307-a3d8-b283c03916dd}" \
    CORECLR_PROFILER_PATH="[AzureWebJobsScriptRoot]/bin/instana_tracing/CoreProfiler.so" \
    INSTANA_ENDPOINT_URL="[Serverless-ingress-URL-for-your-region]" \
    INSTANA_AGENT_KEY="[Your-Instana-agent-key]"

INSTANA_ENDPOINT_URL 值視您的地區而定。 如需相關資訊,請參閱 無伺服器監視的端點 文件。

如需在 .NET Core 中設定 Instana 的相關資訊,請參閱 。NET Core 文件。

Azure 功能應用程式不需要安裝及使用 Instana Nuget 套件,而是需要將所有 Instana Nuget 套件複製到 Azure上應用程式發行所在的 release 資料夾。 當使用 Docker Container 選項在 Azure 上部署 Azure 函數應用程式時,這是必要的。

如需我們的套件相關資訊,請參閱 。NET 追蹤 文件。

下載最新 Instana.Tracing.CoreInstana.Tracing.Core.SdkInstana.Tracing.Core.Rewriter.Linux 套件,以確定您正在使用最新版本。

下載程序完成之後,請將下列檔案複製到「 Azure 功能應用程式」中的部分資料夾 (可從 Dockerfile輕鬆存取):

  • Instana.Tracing.Core.dll
  • Instana.Tracing.Core.Common.dll
  • Instana.Tracing.Core.Instrumentation.dll
  • Instana.Tracing.Core.Transport.dll
  • Instana.Tracing.Api.dll
  • CoreProfiler.so
  • instrumentation.json

然後,將這些檔案複製到 Azure 上的 release 資料夾,如下所示:

    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Core.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.dll"
    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Core.Common.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.Common.dll"
    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Core.Instrumentation.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.Instrumentation.dll"
    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Core.Transport.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Core.Transport.dll"
    COPY "/[path-to-your-patch-folder]/Instana.Tracing.Api.dll" "[AzureWebJobsScriptRoot]/bin/Instana.Tracing.Api.dll"
    COPY "/[path-to-your-patch-folder]/CoreProfiler.so" "[AzureWebJobsScriptRoot]/bin/instana_tracing/CoreProfiler.so"
    COPY "/[path-to-your-patch-folder]/instrumentation.json" "[AzureWebJobsScriptRoot]/bin/instana_tracing/instrumentation.json "                        

附註: 請勿直接在「 Azure 功能應用程式」中安裝 Instana.Tracing.Core 套件。 在部署應用程式之後,如果有重複的程式庫檔案,追蹤將無法運作。

然後,刪除 Instana.Tracing.Core 套件,並遵循本主題中已說明的指示,將檔案庫檔案複製到 Dockerfile內的 release 資料夾。

支援的觸發程式

您可以找到 Instana 支援的 Azure Functions 觸發程式清單。 到目前為止,其中一些已經過測試,且已知行為。 其餘的設備測試仍未測試。 下表將在狀態變更時立即更新。

在測試期間會看到一種行為,亦即,如果 Azure 函數的 執行 方法是 STATIC,則部分遺漏資料位於產生的跨距內,例如 Function name 或甚至 Trigger name (若為「佇列」觸發程式)。 如果方法是 STATIC,則 Instana 檢測無法收集 執行 方法的所有必要資料。 建議您儘可能使用 NON-STATIC 方法。

觸發程式名稱 已測試 使用 STATIC 方法的可見跨距資料 使用 NON-STATIC 方法的可見跨距資料
二進位大型物件 未測試。
CosmosDB 未測試。
事件網格 未測試。
事件中心 未測試。
Kafka 未測試。
HTTP 監控同時使用 STATIC 及 NON-STATIC 方法。 觸發程式方法名稱執行時期 觸發程式方法名稱執行時期函數名稱
佇列 檢測僅使用 NON-STATIC 方法。 方法名稱執行時期 觸發程式方法名稱執行時期函數名稱
RabbitMQ 未測試。
匯流排 未測試。
SignalR 未測試。
表格 未測試。
計時器 監控同時使用 STATIC 及 NON-STATIC 方法。 觸發程式方法名稱執行時期 觸發程式方法名稱執行時期函數名稱

檢視度量值

若要檢視度量值,請完成下列步驟:

  1. 在 Instana 使用者介面的資訊看板中,選取 基礎架構
  2. 按一下特定的受監視主機。

然後,您可以查看包含所有已收集度量及受監視處理程序的主機儀表板。

度量值

附註: 每分鐘都會取回 Functions 服務的度量值,這是 Azure 用來監視這些服務的解決方案。

度量名稱 說明
要求 要求總數,不論其產生的 HTTP 狀態碼為何。 適用於 WebApps 和 FunctionApps。
接收的位元組數 Azure Spring Cloud 從用戶端接收的位元組計數。
傳送的位元組數 Azure Spring Cloud 傳送至用戶端的位元組計數。
Http101 導致 HTTP 狀態碼 101 的要求計數。
Http2xx The count of requests resulting in an HTTP status code = 200 but < 300.
Http3xx The count of requests resulting in an HTTP status code = 300 but < 400.
Http4xx The count of requests resulting in an HTTP status code = 400 but < 500.
Http5xx The count of requests resulting in an HTTP status code = 500 but < 600.
記憶體工作集 應用程式所使用的現行記憶體數量 (在 MiB中)。 適用於 WebApps 和 FunctionApps。
平均記憶體工作集 應用程式所使用的平均記憶體數量,以 MB 為單位 (MiB)。 適用於 WebApps 和 FunctionApps。
HTTP 回應時間 應用程式處理要求所花費的時間 (以秒為單位)。 適用於 WebApps 和 FunctionApps。
IoReadBytesPer 應用程式程序從 I/O 作業讀取位元組的速率。 適用於 WebApps 和 FunctionApps。
IoWriteBytesPer 應用程式程序將位元組寫入 I/O 作業的速率。 適用於 WebApps 和 FunctionApps。
IoReadOperationsPer 應用程式程序發出讀取 I/O 作業的速率。 適用於 WebApps 和 FunctionApps。
IoWriteOperationsPer 應用程式程序發出寫入 I/O 作業的速率。 適用於 WebApps 和 FunctionApps。
RequestsInApplicationQueue 應用程式要求佇列中的要求數。 適用於 WebApps 和 FunctionApps。
HealthCheck狀態 性能檢查狀態。 適用於 WebApps 和 FunctionApps。
FileSystem使用情形 應用程式耗用的檔案系統配額百分比。 適用於 WebApps 和 FunctionApps。

配置資料

FunctionApps

FunctionApp 服務詳細資料 說明
ID 功能應用程式的唯一 ID。
名稱 FunctionApp 實例的名稱。
類型 FunctionApp 類型。
位置 實例所在的地區。
類型 指出 FunctionApp 帳戶的類型。
訂閱 FunctionApp 服務實例的訂閱 ID。
資源群組 FunctionApp 服務實例的資源群組。
狀態 實例的現行部署狀態。

函數

功能服務詳細資料 說明
ID 函數的唯一 ID。
名稱 「函數」服務實例的名稱。
類型 功能服務類型。
位置 實例所在的地區。
訂閱 「功能」服務實例的訂閱 ID。
資源群組 Functions 服務實例的資源群組。