Cloud Storage FUSE 指標

本頁面概述 Cloud Storage FUSE 的指標,以及如何收集、匯出及分析指標資料。

總覽

使用 Cloud Storage FUSE 將 bucket 掛接至 Cloud Storage 做為檔案系統時,Cloud Storage 會提供 Cloud Storage FUSE 的深入指標。指標可協助您持續監控效能、找出可能影響輸送量和延遲時間的潛在瓶頸,以及在發生問題時迅速解決。

為進行診斷,您可以在使用 Cloud Storage FUSE 時,在背景收集指標。Cloud Storage 提供兩種收集、匯出及分析指標的方式:

  • Cloud Monitoring 匯出工具:指標會直接從 Cloud Storage FUSE 收集並匯出至 Cloud Monitoring。匯出的指標隨後會顯示在 Google Cloud 控制台中。

  • Prometheus 連接埠:指標會以 Prometheus 指標文字格式匯出至指定的 Prometheus 連接埠,例如 http://Host:prometheus-port/metrics,並使用 Prometheus 開放原始碼監控和快訊工具包。然後,您可以使用用戶端網址 (例如 curl http://host:port/metrics) 將指標視為輸出內容。

定價

系統會根據用量收取 Cloud Storage FUSE 指標費用。如要進一步瞭解價格,請參閱 Google Cloud Observability 定價

使用 Cloud Monitoring 匯出工具

如要使用 Cloud Monitoring 匯出工具,將 Cloud Storage FUSE 的指標匯出、收集及分析至 Cloud Monitoring,請完成下列各節所述步驟。

取得必要角色

如要取得使用 Cloud Monitoring 匯出工具所需的權限,請在要收集指標的專案中,授予「Monitoring Metric Writer」 (roles/monitoring.metricWriter) IAM 角色。

這個預先定義的角色具備使用 Cloud Monitoring 匯出工具所需的權限。如要進一步瞭解 Monitoring Metric Writer 角色,請參閱有關 roles/monitoring.metricWriter 的 IAM 說明文件。

如需授予專案角色的操作說明,請參閱「管理專案存取權」。

事前準備

  1. 啟用 Cloud Monitoring API

  2. 啟用 Cloud Storage API。

    前往 Cloud Storage API

設定 Cloud Monitoring 匯出工具

如要設定 Cloud Monitoring 匯出工具,收集、匯出及分析 Cloud Storage FUSE 指標,請使用 Cloud Storage FUSE 設定檔或 Cloud Storage FUSE CLI,在 metrics:cloud-metrics-export-interval-secs 設定欄位中指定以秒為單位的整數值。--cloud-metrics-export-interval-secs

使用 Google Cloud 控制台查看指標

如要使用 Google Cloud 控制台查看 Cloud Storage FUSE 指標,請按照下列操作說明進行:

  1. 前往 Google Cloud 控制台的「Metrics Explorer」頁面。

    前往 Metrics Explorer

  2. 選取要查看指標的專案。

  3. 在「指標」下拉式選單中,按一下「選取指標」

  4. 選取「VM Instance」(VM 執行個體),然後按一下「Custom」(自訂),並輸入要查看的指標名稱。如要瞭解 Cloud Storage 為 Cloud Storage FUSE 提供哪些指標,請參閱「可用指標」。

使用 Prometheus 匯出、收集及分析指標

以下各節說明如何設定及使用 Prometheus,匯出、收集及分析 Cloud Storage FUSE 指標。

設定 Prometheus

如要設定 Prometheus,請按照「為作業套件代理程式設定 Prometheus」中的操作說明進行。

使用 Prometheus

  1. 使用 Cloud Storage FUSE CLI,透過 Cloud Storage FUSE 設定檔中的 prometheus-port 設定選項或 --prometheus-port CLI 選項,指定要將指標匯出至哪個 HTTP 連接埠。

  2. 使用下列指令驗證 Prometheus 指標端點:

     curl https://localhost:8080/metrics

    如果成功,指令會傳回類似下列文字的輸出內容:

     # HELP file_cache_read_bytes_count The cumulative number of bytes read from file cache along with read type - Sequential/Random
     # TYPE file_cache_read_bytes_count counter
     file_cache_read_bytes_count{read_type="Random"} 0
     file_cache_read_bytes_count{read_type="Sequential"} 80
     # HELP file_cache_read_count Specifies the number of read requests made via file cache along with type - Sequential/Random and cache hit - true/false
     # TYPE file_cache_read_count counter
     file_cache_read_count{cache_hit="false",read_type="Random"} 215
     file_cache_read_count{cache_hit="false",read_type="Sequential"} 5
     # HELP file_cache_read_latencies The cumulative distribution of the file cache read latencies along with cache hit - true/false
     # TYPE file_cache_read_latencies histogram
     file_cache_read_latencies_bucket{cache_hit="false",le="1"} 215
     file_cache_read_latencies_bucket{cache_hit="false",le="2"} 216
     file_cache_read_latencies_bucket{cache_hit="false",le="3"} 216
     file_cache_read_latencies_bucket{cache_hit="false",le="4"} 216
     file_cache_read_latencies_bucket{cache_hit="false",le="5"} 216
     ...
     file_cache_read_latencies_sum{cache_hit="false"} 483.62783500000023
     file_cache_read_latencies_count{cache_hit="false"} 220
     # HELP fs_ops_count The cumulative number of ops processed by the file system.
     # TYPE fs_ops_count counter
     fs_ops_count{fs_op="FlushFile"} 9
     fs_ops_count{fs_op="GetInodeAttributes"} 91
     fs_ops_count{fs_op="LookUpInode"} 584
     fs_ops_count{fs_op="OpenDir"} 122
     fs_ops_count{fs_op="OpenFile"} 9
     fs_ops_count{fs_op="ReadDir"} 184
     fs_ops_count{fs_op="ReadFile"} 220
     fs_ops_count{fs_op="ReleaseDirHandle"} 122
     fs_ops_count{fs_op="ReleaseFileHandle"} 9
     fs_ops_count{fs_op="StatFS"} 10
     # HELP fs_ops_error_count The cumulative number of errors generated by file system operations
     # TYPE fs_ops_error_count counter
     fs_ops_error_count{fs_error_category="NOT_IMPLEMENTED",fs_op="GetXattr"} 1
     fs_ops_error_count{fs_error_category="NOT_IMPLEMENTED",fs_op="ListXattr"} 1
     fs_ops_error_count{fs_error_category="INTERRUPT_ERROR",fs_op="LookUpInode"} 58
     fs_ops_error_count{fs_error_category="NO_FILE_OR_DIR",fs_op="LookUpInode"} 6
     # HELP fs_ops_latency The cumulative distribution of file system operation latencies
     # TYPE fs_ops_latency histogram
     fs_ops_latency_bucket{fs_op="FlushFile",le="1"} 9
     fs_ops_latency_bucket{fs_op="FlushFile",le="2"} 9
     fs_ops_latency_bucket{fs_op="FlushFile",le="3"} 9
     fs_ops_latency_bucket{fs_op="FlushFile",le="4"} 9
     fs_ops_latency_bucket{fs_op="FlushFile",le="5"} 9
     ...
     fs_ops_latency_sum{fs_op="FlushFile"} 0.28800000000000003
     fs_ops_latency_count{fs_op="FlushFile"} 9
     # HELP gcs_download_bytes_count The cumulative number of bytes downloaded from GCS along with type - Sequential/Random
     # TYPE gcs_download_bytes_count counter
     gcs_download_bytes_count{read_type="Sequential"} 2.0971528e+08
     # HELP gcs_read_count Specifies the number of gcs reads made along with type - Sequential/Random
     # TYPE gcs_read_count counter
     gcs_read_count{read_type="Sequential"} 5
     ```

可用的指標

Cloud Storage FUSE 提供下列指標。

檔案系統指標

檔案系統指標可提供掛接值區上執行的作業洞察資料,例如延遲時間和錯誤率。

指標名稱 指標說明
fs/ops_count 檔案系統處理的作業數。這項指標可依 op_type 分組,取得個別作業的計數。
fs/ops_error_count 檔案系統作業產生的錯誤數。 這項指標可依 op_typeerror_category 分組。每個錯誤都會對應至 error_category,且為多對一關係。
fs/ops_latency 檔案系統作業延遲的累積分佈情形。 這項指標可依 op_type 分組。

Cloud Storage 指標

Cloud Storage 指標可深入瞭解 Cloud Storage FUSE 和 Cloud Storage 之間的互動。

指標名稱 指標說明
gcs/download_bytes_count 從 Cloud Storage 下載的位元組數,以及讀取類型。讀取類型會指定循序、隨機或平行讀取。
gcs/read_bytes_count 從 Cloud Storage 物件讀取的位元組數,與 download_bytes_count 不同。舉例來說,從 Cloud Storage 擷取的資料量超出應用程式實際使用的量。
gcs/read_count 從 Cloud Storage 讀取的次數和讀取類型,包括循序、隨機或平行。
gcs/reader_count 開啟或關閉的 Cloud Storage 物件讀取器數量。這項指標的資料會依輸入/輸出 (I/O) 方法類型 (例如 openedclosed) 分組。
gcs/request_count 處理的 Cloud Storage 要求數量。
gcs/request_latencies Cloud Storage 要求延遲時間的總分布情形。

檔案快取指標

檔案快取指標可深入瞭解 Cloud Storage FUSE 檔案快取作業的效能和行為。

指標名稱 指標說明
file_cache/read_bytes_count 從檔案快取讀取的位元組數和讀取類型 (循序或隨機)。
file_cache/read_latencies 檔案快取讀取延遲時間的總分配情形,以及快取命中 (true 或 false)。
file_cache/read_count 使用檔案快取發出的讀取要求數量、要求類型 (例如循序或隨機) 和快取命中 (true 或 false)。

後續步驟