Prometheus .Net 核心用戶端程式庫

簡介

Prometheus .Net Core 用戶端程式庫 是 .NET Core 度量程式庫。 Instana 支援 4.0、 5.0 和 6.0 版。

Instana 將自動偵測 Prometheus .Net Core Client 程式庫,並在 .NET Core 處理程序儀表板上顯示度量值。

擷取畫面: Prometheus .Net 核心用戶端度量值

配置

所有配置選項都是選用的。 依預設配置, Instana 不會監視來自 Prometheus .NET Core 用戶端程式庫的度量值,應該手動開啟它。

不過,您可以改寫預設值,方法是在代理程式的 configuration.yaml 檔案中的 com.instana.plugin.netcore 下新增 prometheusMetricCollection 區段,如下列範例所示:

com.instana.plugin.netcore:
  prometheusMetricCollection:
    enabled: true
    limit: 200
    pollIntervalSeconds: 15
    excludeMetricNamesStartingWith:
      - dotnet
      - process
    excludeMetricsMatching:
      - eu-central-1

支援下列配置選項:

  • enabled: 將此設為 false ,以停用監視 Prometheus .Net Core Client 程式庫。 預設值:false

  • limit: 為了避免監視後端超載,我們限制每個 .Net Core 處理程序的度量數。 您可以使用此配置選項來變更限制。 預設值: 200

  • pollIntervalSeconds: 一般而言, Instana 提供 1 秒的度量解決方案。 為了避免自訂回呼可能超載,依預設,我們將 Prometheus .Net Core 用戶端程式庫中度量值的輪詢間隔增加至 15 秒。 使用此配置選項來增加或減少輪詢間隔。 預設值: 15

  • excludeMetricNamesStartingWith: 不應監視的度量名稱字首清單。 例如,上述配置會排除以 dotnet 開頭的所有度量,以及以 process開頭的所有度量,因此您無法看到下列度量:

    process_cpu_seconds_total 0.99
    process_open_fds 23.0
    dotnet_total_memory_bytes 13.07M
    ```* `includeMetricNamesStartingWith`: Counterpart to `excludeMetricNamesStartingWith`. Only metrics starting with one of these prefixes will be included.
    
  • excludeMetricsMatching: 這是 excludeMetricNamesStartingWith的更強大替代方案: 將排除符合其中一個正規表示式清單的所有度量值。 正規表示式會套用至完整度量字串,包括諸如 counter_total{region="eu-central-1"}之類的標籤,而不只是套用至度量名稱。 正規表示式未錨定,亦即,它可以在字串中間的任何位置符合。 例如,如果您在 excludeMetricsMatching 清單中指定 eu-central-1 ,則會排除度量 counter_total{region="eu-central-1"}

  • includeMetricsMatching: 對應至 excludeMetricsMatching。 只會包含符合清單中其中一個正規表示式的度量,並排除所有其他度量。