...
The process of adding stats to Geode is pretty straight forward. However, a general understanding of Geode's different stat types will make this process a bit clearer.
Background
Creating a Stat...
Stats in Geode are grouped according to functional area in their own class. For instance, the Geode DistributionStats
in the comthe org.
gemstoneapache.
gemfiregeode.distributed.internal
package track statistical information concerning Geode's distribution layer. These stats are all related to p2p message distribution across the Geode distributed system along with sender and receiver connections, and so on.
public void incConnectionFactoryPoolSweeps();
Then, I would modify the DistributionStats
class like so..
Code Block | ||
---|---|---|
| ||
private static final int connectionFactoryPoolSweepsId; ... static { ... private StatisticsTypeFactory typeFactory = StatisticsTypeFactoryImpl.singleton(); private StatisticsType type = typeFactory.createType("DistributionStats", "Statistics on the geode distribution layer.", new StatisticDescriptor[] { ..., typeFactory.createIntCounter("cxpConnectionFactoryPoolSweeps", "The number of times "+ "the poolable Connection Factory Sweeper Thread has run.", "sweeps"), ... }); ... connectionFactoryPoolSweepsId = type.nameToId("cxpConnectionFactoryPoolSweeps"); } ... private final Statistics stats; public DistributionStats(StatisticsFactory statsFactory, long statId) { this.stats = statsFactory.createAtomicStatistics(type, "distributionStats", statId); } public void incConnectionFactoryPoolSweeps() { stats.incInt(connectionFactoryPoolSweepsId, 1); } |
Code Block | ||
---|---|---|
| ||
... typeFactory.createIntGauge("cxpPooledConnectionResourceCount", "A count at any given moment of the number of pooled Connection resources "+ "maintained by the Connection Factory.", "pooled-connections"), ... pooledConnectionResourceCountId = type.nameToId("cxpPooledConnectionResourceCount"); ... public void setPooledConnectionResourceCount(int pooledConnectionResourceCount) { stats.setInt(pooledConnectionResourceCountId, pooledConnectionResourceCount); } |
Code Block | ||
---|---|---|
| ||
getDistributionStats().setPooledConnectionResourceCount(pooledConnectionResourceCount); |
For more information about Stats, please see the Geode User's Guide.