4.2. 配置数据网格指标
配置 Data Grid,以通过 指标端点 导出量表和直方图。
流程
-
根据需要
在指标配置中打开或关闭量表和直方图。
声明
<!-- Computes and collects statistics for the Cache Manager. --> <cache-container statistics="true"> <!-- Exports collected statistics as gauge and histogram metrics. --> <metrics gauges="true" histograms="true" /> </cache-container>
<!-- Computes and collects statistics for the Cache Manager. -->
<cache-container statistics="true">
<!-- Exports collected statistics as gauge and histogram metrics. -->
<metrics gauges="true" histograms="true" />
</cache-container>
programmatic
4.2.1. 收集数据网格指标 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
使用 Prometheus 等监控工具来收集数据网格指标。
先决条件
-
启用统计信息。如果没有启用统计信息,Data Grid 为指标提供
0和-1值。 - (可选)启用直方图。默认情况下,Data Grid 生成量表,但不生成直方图。
流程
获取 Prometheus (OpenMetrics)格式的指标:
curl -v http://localhost:11222/metrics
$ curl -v http://localhost:11222/metricsCopy to Clipboard Copied! Toggle word wrap Toggle overflow 以 MicroProfile JSON 格式获取指标:
curl --header "Accept: application/json" http://localhost:11222/metrics
$ curl --header "Accept: application/json" http://localhost:11222/metricsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
后续步骤
配置监控应用程序以收集数据网格指标。例如,将以下内容添加到 prometheus.yml 中:
static_configs:
- targets: ['localhost:11222']
static_configs:
- targets: ['localhost:11222']
参考
- Prometheus 配置
- 启用 Data Grid Statistics