This topic discusses application-defined and custom statistics in VMware Tanzu GemFire.
Tanzu GemFire includes interfaces for defining and maintaining your own statistics.
The Tanzu GemFire package, org.apache.geode
, includes the following interfaces for defining and maintaining your own statistics:
StatisticDescriptors
and provides access methods to them. The StatisticDescriptors
contained by a StatisticsType
are each assigned a unique ID within the list. StatisticsType
is used to create a Statistics
instance.StatisticsType
object with methods for setting, incrementing, getting individual StatisticDescriptor
values, and setting a callback which will recompute the statistic’s value at configured sampling intervals.Statistics
. You can also use it to create instances of StatisticDescriptor
and StatisticsType
, because it implements StatisticsTypeFactory
. DistributedSystem
is an instance of StatisticsFactory
.StatisticDescriptor
and StatisticsType
.The statistics interfaces are instantiated using statistics factory methods that are included in the package. For coding examples, see the online Java API documentation for StatisticsFactory
and StatisticsTypeFactory
.
As an example, an application server might collect statistics on each client session in order to gauge whether client requests are being processed in a satisfactory manner. Long request queues or long server response times could prompt some capacity-management action such as starting additional application servers. To set this up, each session-state data point is identified and defined in a StatisticDescriptor
instance. One instance might be a RequestsInQueue
gauge, a non-negative integer that increments and decrements. Another could be a RequestCount
counter, an integer that always increments. A list of these descriptors is used to instantiate a SessionStateStats
StatisticsType
. When a client connects, the application server uses the StatisticsType
object to create a session-specific Statistics
object. The server then uses the Statistics
methods to modify and retrieve the client’s statistics. The figures below illustrate the relationships between the statistics interfaces and show the implementation of this use case.
The Statistics Interfaces
Each StatisticDescriptor
contains one piece of statistical information. StatisticalDesriptor
objects are collected into a StatisticsType
. The StatisticsType
is instantiated to create a Statistics
object.
Statistics Implementation
The StatisticDescriptor
objects shown here hold three pieces of statistical information about client session state. These are collected into a SessionStateStats StatisticsType
. With this type, the server creates a Statistics
object for each client that connects.