第 4 章 启用 Data Grid Statistics
配置 Data Grid 以导出缓存管理器和缓存的统计信息。
流程
修改您的配置,以以下方法之一启用 Data Grid 统计:
-
declarative: 添加
statistics="true"属性。 -
programmatic :调用
.statistics ()方法。
声明
<!-- Enables statistics for the Cache Manager. -->
<cache-container statistics="true">
<!-- Enables statistics for the named cache. -->
<local-cache name="mycache" statistics="true"/>
</cache-container>
programmatic
GlobalConfiguration globalConfig = new GlobalConfigurationBuilder()
//Enables statistics for the Cache Manager.
.cacheContainer().statistics(true)
.build();
Configuration config = new ConfigurationBuilder()
//Enables statistics for the named cache.
.statistics().enable()
.build();