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>
Copy to Clipboard Toggle word wrap

programmatic

GlobalConfiguration globalConfig = new GlobalConfigurationBuilder()
  //Computes and collects statistics for the Cache Manager.
  .statistics().enable()
  //Exports collected statistics as gauge and histogram metrics.
  .metrics().gauges(true).histograms(true)
  .build();
Copy to Clipboard Toggle word wrap

4.2.1. 收集数据网格指标

使用 Prometheus 等监控工具来收集数据网格指标。

先决条件

  • 启用统计信息。如果没有启用统计信息,Data Grid 为指标提供 0-1 值。
  • (可选)启用直方图。默认情况下,Data Grid 生成量表,但不生成直方图。

流程

  • 获取 Prometheus (OpenMetrics)格式的指标:

    $ curl -v http://localhost:11222/metrics
    Copy to Clipboard Toggle word wrap
  • 以 MicroProfile JSON 格式获取指标:

    $ curl --header "Accept: application/json" http://localhost:11222/metrics
    Copy to Clipboard Toggle word wrap

后续步骤

配置监控应用程序以收集数据网格指标。例如,将以下内容添加到 prometheus.yml 中:

static_configs:
    - targets: ['localhost:11222']
Copy to Clipboard Toggle word wrap

参考

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat