Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixing paragraph format I introduced in last change

...

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.

...

Code Block
languagejava
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);
}

 

The Geode DistributedSystem class is an instance of the StatisticsFactory interface and is the reference value passed to the constructor of the DistributionStats class when it is created. This StatisticsFactory implementation is used to obtain theStatistics references to the aspect of Geode you want to track. The Statisticsinterface is a facade to managing and accessing the statistics information and values.

...

Code Block
languagejava
...

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);
}
 

The code required to make use of these new statistic values is pretty straight forward as well. Provided a reference to a our stats class, like DistributionStats, I can make method calls in the normal manner...

...