本页面简要介绍了 Cloud Storage FUSE 的指标,以及如何收集、导出和分析指标数据。
概览
当您使用 Cloud Storage FUSE 将存储分区作为文件系统装载到 Cloud Storage 时,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: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 文档。
如需了解如何授予项目角色,请参阅管理对项目的访问权限。
准备工作
启用 Cloud Storage API。
设置 Cloud Monitoring 导出器
如需设置 Cloud Monitoring 导出程序以收集、导出和分析 Cloud Storage FUSE 指标,请使用 Cloud Storage FUSE 配置文件中的 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 页面。
选择要查看指标的项目。
在指标下拉菜单中,点击选择指标。
选择虚拟机实例,然后点击自定义并输入要查看的指标的名称。如需查看 Cloud Storage 为 Cloud Storage FUSE 提供哪些指标,请参阅可用指标。
使用 Prometheus 导出、收集和分析指标
以下部分介绍了如何配置和使用 Prometheus 来导出、收集和分析 Cloud Storage FUSE 指标。
配置 Prometheus
如需配置 Prometheus,请按照为 Ops Agent 配置 Prometheus 中的说明操作。
使用 Prometheus
使用 Cloud Storage FUSE 配置文件中的
prometheus-port
配置选项或使用 Cloud Storage FUSE CLI 中的--prometheus-port
CLI 选项,指定要将指标导出到的 HTTP 端口。使用以下命令验证 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="function not implemented",fs_error_category="function not implemented",fs_op="GetXattr"} 1 fs_ops_error_count{fs_error="function not implemented",fs_error_category="function not implemented",fs_op="ListXattr"} 1 fs_ops_error_count{fs_error="interrupted system call",fs_error_category="interrupt errors",fs_op="LookUpInode"} 58 fs_ops_error_count{fs_error="no such file or directory",fs_error_category="no such file or directory",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_type 和 error_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/reader_count |
打开或关闭的 Cloud Storage 对象读取器的数量。此指标的数据会按输入/输出 (I/O) 方法类型(例如 opened 或 closed )进行分组。 |
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)。 |