Package org.apache.geode
Interface StatisticsTypeFactory
- All Known Subinterfaces:
StatisticsFactory
- All Known Implementing Classes:
DistributedSystem
public interface StatisticsTypeFactory
Instances of this interface provide methods that create instances of
StatisticDescriptor
and StatisticsType. Every StatisticsFactory is also a type factory.
A StatisticsTypeFactory can create a statistic of three
numeric types: int, long, and double. A statistic
(StatisticDescriptor) can either be a gauge meaning that its value can
increase and decrease or a counter meaning that its value is strictly increasing.
The following code is an example of how to create a type using code. In this example the type has two counters:
StatisticsTypeFactory f = ...;
StatisticsType t = f.createType(
"StatSampler",
"Stats on the statistic sampler.",
new StatisticDescriptor[] {
f.createLongCounter("sampleCount",
"Total number of samples taken by this sampler.",
"samples"),
f.createLongCounter("sampleTime",
"Total amount of time spent taking samples.",
"milliseconds"),
}
);
The following is an example of how to create the same type using XML. The XML data:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE statistics PUBLIC
"-//GemStone Systems, Inc.//GemFire Statistics Type//EN"
"http://www.gemstone.com/dtd/statisticsType.dtd">
<statistics>
<type name="StatSampler">
<description>Stats on the statistic sampler.</description>
<stat name="sampleCount" storage="long" counter="true">
<description>Total number of samples taken by this sampler.</description>
<unit>samples</unit>
</stat>
<stat name="sampleTime" storage="long" counter="true">
<description>Total amount of time spent taking samples.</description>
<unit>milliseconds</unit>
</stat>
</type>
</statistics>
The code to create the type:
StatisticsTypeFactory f = ...;
Reader r = new InputStreamReader("fileContainingXmlData"));
StatisticsType type = f.createTypesFromXml(r)[0];
- Since:
- GemFire 3.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum number of descriptors a single statistics type can have. -
Method Summary
Modifier and TypeMethodDescriptioncreateDoubleCounter(String name, String description, String units) Creates and returns a double counterStatisticDescriptorwith the givenname,description,units, and with larger values indicating better performance.createDoubleCounter(String name, String description, String units, boolean largerBetter) Creates and returns a double counterStatisticDescriptorwith the givenname,description,largerBetter, andunits.createDoubleGauge(String name, String description, String units) Creates and returns a double gaugeStatisticDescriptorwith the givenname,description,units, and with smaller values indicating better performance.createDoubleGauge(String name, String description, String units, boolean largerBetter) Creates and returns a double gaugeStatisticDescriptorwith the givenname,description,largerBetter, andunits.createIntCounter(String name, String description, String units) Deprecated.createIntCounter(String name, String description, String units, boolean largerBetter) Deprecated.as of Geode 1.10, usecreateLongCounter(String, String, String, boolean)insteadcreateIntGauge(String name, String description, String units) Deprecated.as of Geode 1.10, usecreateLongGauge(String, String, String)insteadcreateIntGauge(String name, String description, String units, boolean largerBetter) Deprecated.as of Geode 1.10, usecreateLongGauge(String, String, String, boolean)insteadcreateLongCounter(String name, String description, String units) Creates and returns a long counterStatisticDescriptorwith the givenname,description,units, and with larger values indicating better performance.createLongCounter(String name, String description, String units, boolean largerBetter) Creates and returns a long counterStatisticDescriptorwith the givenname,description,largerBetter, andunits.createLongGauge(String name, String description, String units) Creates and returns a long gaugeStatisticDescriptorwith the givenname,description,units, and with smaller values indicating better performance.createLongGauge(String name, String description, String units, boolean largerBetter) Creates and returns a long gaugeStatisticDescriptorwith the givenname,description,largerBetter, andunits.createType(String name, String description, StatisticDescriptor[] stats) Creates or finds and returns aStatisticsTypewith the givenname,description, andstatistic descriptions.createTypesFromXml(Reader reader) Creates one or moreStatisticsTypefrom the contents of the givenreader.Finds and returns an already createdStatisticsTypewith the givenname.
-
Field Details
-
MAX_DESCRIPTORS_PER_TYPE
static final int MAX_DESCRIPTORS_PER_TYPEThe maximum number of descriptors a single statistics type can have.Current value is:
254- See Also:
-
-
Method Details
-
createIntCounter
Deprecated.as of Geode 1.10, usecreateLongCounter(String, String, String)insteadCreates and returns an int counterStatisticDescriptorwith the givenname,description,units, and with larger values indicating better performance.- Parameters:
name- the name of the int counterStatisticDescriptordescription- the description of the int counterStatisticDescriptorunits- the units of the int counterStatisticDescriptor- Returns:
- a newly created int counter
StatisticDescriptor
-
createLongCounter
Creates and returns a long counterStatisticDescriptorwith the givenname,description,units, and with larger values indicating better performance.- Parameters:
name- the name of the long counterStatisticDescriptordescription- the description of the long counterStatisticDescriptorunits- the units of the long counterStatisticDescriptor- Returns:
- a newly created long counter
StatisticDescriptor
-
createDoubleCounter
Creates and returns a double counterStatisticDescriptorwith the givenname,description,units, and with larger values indicating better performance.- Parameters:
name- the name of the double counterStatisticDescriptordescription- the description of the double counterStatisticDescriptorunits- the units of the double counterStatisticDescriptor- Returns:
- a newly created double counter
StatisticDescriptor
-
createIntGauge
Deprecated.as of Geode 1.10, usecreateLongGauge(String, String, String)insteadCreates and returns an int gaugeStatisticDescriptorwith the givenname,description,units, and with smaller values indicating better performance.- Parameters:
name- the name of the int gaugeStatisticDescriptordescription- the description of the int gaugeStatisticDescriptorunits- the units of the int gaugeStatisticDescriptor- Returns:
- a newly created int gauge
StatisticDescriptor
-
createLongGauge
Creates and returns a long gaugeStatisticDescriptorwith the givenname,description,units, and with smaller values indicating better performance.- Parameters:
name- the name of the long gaugeStatisticDescriptordescription- the description of the long gaugeStatisticDescriptorunits- the units of the long gaugeStatisticDescriptor- Returns:
- a newly created long gauge
StatisticDescriptor
-
createDoubleGauge
Creates and returns a double gaugeStatisticDescriptorwith the givenname,description,units, and with smaller values indicating better performance.- Parameters:
name- the name of the double gaugeStatisticDescriptordescription- the description of the double gaugeStatisticDescriptorunits- the units of the double gaugeStatisticDescriptor- Returns:
- a newly created double gauge
StatisticDescriptor
-
createIntCounter
@Deprecated StatisticDescriptor createIntCounter(String name, String description, String units, boolean largerBetter) Deprecated.as of Geode 1.10, usecreateLongCounter(String, String, String, boolean)insteadCreates and returns an int counterStatisticDescriptorwith the givenname,description,largerBetter, andunits.- Parameters:
name- the name of the int counterStatisticDescriptordescription- the description of the int counterStatisticDescriptorunits- the units of the int counterStatisticDescriptorlargerBetter- whether larger values indicate better performance- Returns:
- a newly created int counter
StatisticDescriptor
-
createLongCounter
StatisticDescriptor createLongCounter(String name, String description, String units, boolean largerBetter) Creates and returns a long counterStatisticDescriptorwith the givenname,description,largerBetter, andunits.- Parameters:
name- the name of the long counterStatisticDescriptordescription- the description of the long counterStatisticDescriptorunits- the units of the long counterStatisticDescriptorlargerBetter- whether larger values indicate better performance- Returns:
- a newly created long counter
StatisticDescriptor
-
createDoubleCounter
StatisticDescriptor createDoubleCounter(String name, String description, String units, boolean largerBetter) Creates and returns a double counterStatisticDescriptorwith the givenname,description,largerBetter, andunits.- Parameters:
name- the name of the double counterStatisticDescriptordescription- the description of the double counterStatisticDescriptorunits- the units of the double counterStatisticDescriptorlargerBetter- whether larger values indicate better performance- Returns:
- a newly created double counter
StatisticDescriptor
-
createIntGauge
@Deprecated StatisticDescriptor createIntGauge(String name, String description, String units, boolean largerBetter) Deprecated.as of Geode 1.10, usecreateLongGauge(String, String, String, boolean)insteadCreates and returns an int gaugeStatisticDescriptorwith the givenname,description,largerBetter, andunits.- Parameters:
name- the name of the int gaugeStatisticDescriptordescription- the description of the int gaugeStatisticDescriptorunits- the units of the int gaugeStatisticDescriptorlargerBetter- whether larger values indicate better performance- Returns:
- a newly created int gauge
StatisticDescriptor
-
createLongGauge
StatisticDescriptor createLongGauge(String name, String description, String units, boolean largerBetter) Creates and returns a long gaugeStatisticDescriptorwith the givenname,description,largerBetter, andunits.- Parameters:
name- the name of the long gaugeStatisticDescriptordescription- the description of the long gaugeStatisticDescriptorunits- the units of the long gaugeStatisticDescriptorlargerBetter- whether larger values indicate better performance- Returns:
- a newly created long gauge
StatisticDescriptor
-
createDoubleGauge
StatisticDescriptor createDoubleGauge(String name, String description, String units, boolean largerBetter) Creates and returns a double gaugeStatisticDescriptorwith the givenname,description,largerBetter, andunits.- Parameters:
name- the name of the double gaugeStatisticDescriptordescription- the description of the double gaugeStatisticDescriptorunits- the units of the double gaugeStatisticDescriptorlargerBetter- whether larger values indicate better performance- Returns:
- a newly created double gauge
StatisticDescriptor
-
createType
Creates or finds and returns aStatisticsTypewith the givenname,description, andstatistic descriptions.- Parameters:
name- the name of theStatisticsTypeto create or finddescription- the description of theStatisticsTypeto create or findstats- the statistic descriptions of theStatisticsTypeto create or find- Returns:
- a
StatisticsTypewith the givenname,description, andstatistic descriptions - Throws:
IllegalArgumentException- if a type with the givennamealready exists and it differs from the given parameters.
-
findType
Finds and returns an already createdStatisticsTypewith the givenname. Returnsnullif the type does not exist.- Parameters:
name- the name of theStatisticsTypeto find- Returns:
- an already created
StatisticsTypewith the givenname
-
createTypesFromXml
Creates one or moreStatisticsTypefrom the contents of the givenreader. The created types can be found by callingfindType(java.lang.String).- Parameters:
reader- The source of the XML data which must comply with thestatisticsType.dtd.- Returns:
- an array of newly created
StatisticsTypes - Throws:
IllegalArgumentException- if a type defined in the reader already existsIOException- Something went wrong while reading fromreader
-
createLongCounter(String, String, String)instead