Cloud Storage FUSE 指標可協助您持續監控效能、找出可能影響處理量和延遲時間的潛在瓶頸,並在問題發生時快速解決。當您使用 Cloud Storage FUSE 將 bucket 掛接為檔案系統時,Cloud Storage 會提供 Cloud Storage FUSE 的深入指標。本文將概略介紹這些指標,並說明如何收集、匯出及分析指標資料。
指標收集方法
使用 Cloud Storage FUSE 時,您可以在背景收集指標,用於診斷。Cloud Storage 提供兩種收集、匯出及分析指標的方法:
Cloud Monitoring 匯出工具:指標會直接從 Cloud Storage FUSE 收集並匯出至 Cloud Monitoring。匯出的指標可在 Google Cloud 控制台中查看。
Prometheus 通訊埠:使用 Prometheus 開放原始碼監控和快訊工具包,以 Prometheus 指標文字格式,在指定的 Prometheus 通訊埠 (例如
http://HOST:PROMETHEUS_PORT/metrics) 匯出指標。接著,您可以使用用戶端網址 (例如curl http://HOST:PROMETHEUS_PORT/metrics) 查看指標輸出內容。
定價
Cloud Storage FUSE 指標會依用量計費。如要進一步瞭解定價,請參閱「Google Cloud Observability 定價」。
使用 Cloud Monitoring 匯出工具
如要使用 Cloud Monitoring 匯出工具,將指標從 Cloud Storage FUSE 匯出、收集及分析至 Cloud Monitoring,請完成下列各節所述的步驟。
取得必要角色
如要取得使用 Cloud Monitoring 匯出工具所需的權限,請要求管理員授予您專案的 Monitoring 指標寫入者 (roles/monitoring.metricWriter) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
事前準備
啟用 Cloud Storage API。
設定 Cloud Monitoring 匯出工具
如要設定 Cloud Monitoring 匯出工具,以便收集、匯出及分析 Cloud Storage FUSE 指標,請使用 Cloud Storage FUSE 設定檔,透過 metrics:cloud-metrics-export-interval-secs 欄位指定整數值 (以秒為單位),或使用 Cloud Storage FUSE CLI,透過 --cloud-metrics-export-interval-secs 選項指定整數值。
使用 Google Cloud 控制台查看指標
如要使用 Google Cloud 控制台查看 Cloud Storage FUSE 指標,請按照下列操作說明進行:
前往 Google Cloud 控制台的「Metrics Explorer」頁面。
選取要查看指標的專案。
在「指標」下拉式選單中,點選「選取指標」。
選取資源類型:
- 如果是 Compute Engine VM,請依序選取「VM 執行個體」>「自訂指標」。
如果是 GKE 叢集,請選取 GKE 版本的資源類型:
- 1.37.2-gke.1467000 以上版本:依序選取「Kubernetes GCSFuse Volume」>「Volume」。
- 1.37.2-gke.1467000 之前版本:依序選取「Kubernetes Pod」>「Gcsfusecsi」。
詳情請參閱「GKE 中的 Cloud Storage FUSE 指標」。
輸入要查看的指標名稱。如要查看 Cloud Storage 為 Cloud Storage FUSE 提供的指標,請參閱「可用指標」。
使用 Prometheus 匯出、收集及分析指標
下列各節說明如何設定及使用 Prometheus,匯出、收集及分析 Cloud Storage FUSE 指標。
設定 Prometheus
如要設定 Prometheus,請按照「為 Ops Agent 設定 Prometheus」中的指示操作。
使用 Prometheus
使用 Cloud Storage FUSE 設定檔中的
prometheus-port欄位,或使用gcsfuseCLI 的--prometheus-portgcsfuse選項,指定要將指標匯出至哪個 HTTP 通訊埠。使用下列指令驗證 Prometheus 指標端點:
curl https://localhost:8080/metrics如果成功,指令會傳回類似下列的 Cloud Storage FUSE 版本輸出內容:
3.13.0 以上版本
# 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_latencies The cumulative distribution of file system operation latencies # TYPE fs_ops_latencies histogram fs_ops_latencies_bucket{fs_op="FlushFile",le="1"} 9 fs_ops_latencies_bucket{fs_op="FlushFile",le="2"} 9 fs_ops_latencies_bucket{fs_op="FlushFile",le="3"} 9 fs_ops_latencies_bucket{fs_op="FlushFile",le="4"} 9 fs_ops_latencies_bucket{fs_op="FlushFile",le="5"} 9 ... fs_ops_latencies_sum{fs_op="FlushFile"} 0.28800000000000003 fs_ops_latencies_count{fs_op="FlushFile"} 9 # HELP gcs_download_bytes_count The cumulative number of bytes downloaded from Cloud Storage 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 Cloud Storage reads made along with type - Sequential/Random # TYPE gcs_read_count counter gcs_read_count{read_type="Sequential"} 5
3.13.0 以下版本
# 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 Cloud Storage 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 Cloud Storage reads made along with type - Sequential/Random # TYPE gcs_read_count counter gcs_read_count{read_type="Sequential"} 5
可用的指標
Cloud Storage FUSE 提供下列指標。從 Compute Engine VM 匯出至 Cloud Monitoring 時,這些指標名稱會使用 custom.googleapis.com/gcsfuse/ 前置字元。如要瞭解 GKE 受監控資源和指標名稱,請參閱「GKE 中的 Cloud Storage FUSE 指標」。
檔案系統指標
檔案系統指標可讓您深入分析在掛接值區執行的作業,例如延遲時間和錯誤率。如要查看檔案系統指標,請選取 Cloud Storage FUSE 版本:
3.13.0 以上版本
在 Cloud Storage FUSE 3.13.0 以上版本中,檔案系統作業延遲時間會透過 fs/ops_latencies 指標發出:
| 指標名稱 | 指標說明 |
|---|---|
fs/ops_count |
檔案系統處理的作業數量。您可以依 fs_op 分組這項指標,取得個別作業的計數。 |
fs/ops_error_count |
檔案系統作業產生的錯誤數量。
您可以依 fs_op 和 fs_error_category 將這項指標分組。每個錯誤都會對應至多對一關係中的 fs_error_category。 |
fs/ops_latencies |
檔案系統作業延遲時間的累積分布。您可以依fs_op將這項指標分組。 |
3.13.0 以下版本
在 3.13.0 之前的 Cloud Storage FUSE 版本中,檔案系統作業延遲時間會透過 fs/ops_latency 指標發出:
| 指標名稱 | 指標說明 |
|---|---|
fs/ops_count |
檔案系統處理的作業數量。您可以依 fs_op 分組這項指標,取得個別作業的計數。 |
fs/ops_error_count |
檔案系統作業產生的錯誤數量。
您可以依 fs_op 和 fs_error_category 將這項指標分組。每個錯誤都會對應至多對一關係中的 fs_error_category。 |
fs/ops_latency |
檔案系統作業延遲時間的累積分布。您可以依fs_op將這項指標分組。 |
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) 方法類型 (例如 opened 或 closed) 分組。 |
gcs/request_count |
已處理的 Cloud Storage 要求數量。 |
gcs/request_latencies |
Cloud Storage 要求延遲時間的總分布情形。 |
gcs/retry_count |
向 Cloud Storage 提出的重試要求數量。
這項指標可依 retry_error_category 分組,指定觸發重試的錯誤類別。 |
檔案快取指標
檔案快取指標可讓您深入瞭解 Cloud Storage FUSE 檔案快取作業的效能和行為。
| 指標名稱 | 指標說明 |
|---|---|
file_cache/read_bytes_count |
從檔案快取讀取的位元組數,以及讀取類型 (依序或隨機)。 |
file_cache/read_latencies |
檔案快取讀取延遲時間和快取命中 (true 或 false) 的總分布情形。 |
file_cache/read_count |
使用檔案快取提出的讀取要求數量、要求類型 (例如依序或隨機),以及快取命中 (true 或 false)。 |