Package com.ibm.wsspi.usage.metering
Class MetricDescriptor
- java.lang.Object
-
- com.ibm.wsspi.usage.metering.AggregationMethodDescriptor<MetricDescriptor>
-
- com.ibm.wsspi.usage.metering.MetricDescriptor
-
public class MetricDescriptor extends AggregationMethodDescriptor<MetricDescriptor>
Provides descriptive information about a reportedMetric
, that will be used to control how the metric information is displayed.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.ibm.wsspi.usage.metering.AggregationMethodDescriptor
AggregationMethodDescriptor.RangeAggregationMethod, AggregationMethodDescriptor.SliceAggregationMethod
-
-
Constructor Summary
Constructors Constructor Description MetricDescriptor(java.lang.String type, java.util.Map<java.lang.String,java.lang.String> translatedNames)
Constructs aMetricDescriptor
with all required descriptor attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MetricDescriptor
addGroupDescriptor(MetricGroupDescriptor... descriptors)
boolean
equals(java.lang.Object obj)
java.lang.Number
getDefaultValue()
Returns the value used in intervals where usage data is not sent (e.g.java.util.Set<MetricGroupDescriptor>
getGroupDescriptors()
java.lang.Number
getMaxValue()
Returns the maximum value, for shaping Y axis in charts, or gauges (e.g.java.lang.Number
getMinValue()
Returns the minimum value, for shaping Y axis in charts, or gauges (e.g.java.lang.String
getName()
Returns the untranslated namejava.util.Map<java.lang.String,java.lang.String>
getTranslatedNames()
Returns the translated display names as a map where the key is the language and the value is the translated name of the metric (e.g.java.util.Map<java.lang.String,java.lang.String>
getTranslatedUnits()
Returns the translated display units as a map where the key is the language and the value is the translated unit of the metric (e.g.java.lang.String
getType()
Returns the unique identifier for the metric.java.lang.String
getUnits()
Returns the untranslated unitsint
hashCode()
MetricDescriptor
setDefaultValue(java.lang.Number defaultValue)
Sets the value used in intervals where usage data is not sent (e.g.MetricDescriptor
setMaxValue(java.lang.Number maxValue)
Sets the maximum value, for shaping Y axis in charts, or gauges (e.g.MetricDescriptor
setMinValue(java.lang.Number minValue)
Sets the minimum value, for shaping Y axis in charts, or gauges (e.g.MetricDescriptor
setName(java.lang.String name)
Sets the untranslated nameMetricDescriptor
setRangeAggregationMethods(AggregationMethodDescriptor.RangeAggregationMethod... aggregationMethods)
Sets the aggregation type methods for an entire time range.MetricDescriptor
setSliceAggregationMethods(AggregationMethodDescriptor.SliceAggregationMethod... aggregationMethods)
Sets the aggregation type methods for small time periods (for example, hours when looking at a day).MetricDescriptor
setTranslatedUnits(java.util.Map<java.lang.String,java.lang.String> translatedUnits)
Sets the translated display units as a map where the key is the language and the value is the translated unit of the metric (e.g.MetricDescriptor
setUnits(java.lang.String units)
Sets the untranslated units-
Methods inherited from class com.ibm.wsspi.usage.metering.AggregationMethodDescriptor
getRangeAggregationMethodNames, getRangeAggregationMethods, getSliceAggregationMethodNames, getSliceAggregationMethods
-
-
-
-
Constructor Detail
-
MetricDescriptor
public MetricDescriptor(java.lang.String type, java.util.Map<java.lang.String,java.lang.String> translatedNames)
Constructs aMetricDescriptor
with all required descriptor attributes. Optional attributes should be provided by calling set methods.A MetricDescriptor must provide the following attributes:
- type - unique identifier for the metric (e.g. "PROCESSOR_CORES")
- names - translated display names in a map of language to translated name (e.g. "en", "Processor Cores")
- Parameters:
type
- unique identifier for the metrictranslatedNames
- translated display names for the metric
-
-
Method Detail
-
getType
public java.lang.String getType()
Returns the unique identifier for the metric. This corresponds to the value reported onMetric.getMetricType()
.- Returns:
- the unique identifier for the metric
-
getTranslatedNames
public java.util.Map<java.lang.String,java.lang.String> getTranslatedNames()
Returns the translated display names as a map where the key is the language and the value is the translated name of the metric (e.g. "en", "Processor Cores").- Returns:
- the translated display names
-
getTranslatedUnits
public java.util.Map<java.lang.String,java.lang.String> getTranslatedUnits()
Returns the translated display units as a map where the key is the language and the value is the translated unit of the metric (e.g. "en", "seconds"), or null if units should not be displayed for the metric.Default : null (no units displayed)
- Returns:
- the translated display units
-
getDefaultValue
public java.lang.Number getDefaultValue()
Returns the value used in intervals where usage data is not sent (e.g. because the server is stopped), or null if a default should not be used.Default : null (default value not used)
- Returns:
- the value used in intervals where usage data is not sent
-
getMinValue
public java.lang.Number getMinValue()
Returns the minimum value, for shaping Y axis in charts, or gauges (e.g. 0 for percent values).Default : null (shape based on reported values)
- Returns:
- the minimum value
-
getMaxValue
public java.lang.Number getMaxValue()
Returns the maximum value, for shaping Y axis in charts, or gauges (e.g. 100 for percent values)Default : null (shape based on reported values)
- Returns:
- the maximum value
-
setTranslatedUnits
public MetricDescriptor setTranslatedUnits(java.util.Map<java.lang.String,java.lang.String> translatedUnits)
Sets the translated display units as a map where the key is the language and the value is the translated unit of the metric (e.g. "en", "seconds"), or null if units should not be displayed for the metric.Default : null (no units displayed)
- Parameters:
translatedUnits
- the translated display units- Returns:
- a reference to this object
-
setDefaultValue
public MetricDescriptor setDefaultValue(java.lang.Number defaultValue)
Sets the value used in intervals where usage data is not sent (e.g. because the server is stopped), or null if a default should not be used.Default : null (default value not used)
- Parameters:
defaultValue
- the value used in intervals where usage data is not sent- Returns:
- a reference to this object
-
setMinValue
public MetricDescriptor setMinValue(java.lang.Number minValue)
Sets the minimum value, for shaping Y axis in charts, or gauges (e.g. 0 for percent values).Default : null (shape based on reported values)
- Parameters:
minValue
- the minimum value- Returns:
- a reference to this object
-
setMaxValue
public MetricDescriptor setMaxValue(java.lang.Number maxValue)
Sets the maximum value, for shaping Y axis in charts, or gauges (e.g. 100 for percent values)Default : null (shape based on reported values)
- Parameters:
maxValue
- the maximum value- Returns:
- a reference to this object
-
addGroupDescriptor
public MetricDescriptor addGroupDescriptor(MetricGroupDescriptor... descriptors)
-
getGroupDescriptors
public java.util.Set<MetricGroupDescriptor> getGroupDescriptors()
-
setSliceAggregationMethods
public MetricDescriptor setSliceAggregationMethods(AggregationMethodDescriptor.SliceAggregationMethod... aggregationMethods)
Sets the aggregation type methods for small time periods (for example, hours when looking at a day). If not specified, defaults to MIN, MAX, AVG.Allowed values:
The value NONE cannot be combined with other values and will result in the metric not being displayed for small time periods.
- Overrides:
setSliceAggregationMethods
in classAggregationMethodDescriptor<MetricDescriptor>
- Parameters:
aggregationMethods
- the aggregation type methods for small time periods- Returns:
- a reference to this object
-
setRangeAggregationMethods
public MetricDescriptor setRangeAggregationMethods(AggregationMethodDescriptor.RangeAggregationMethod... aggregationMethods)
Sets the aggregation type methods for an entire time range. If not provided, defaults to MIN, MAX, AVG.Allowed values:
The value NONE cannot be combined with other values and will result in the metric not being displayed for the entire time range.
- Overrides:
setRangeAggregationMethods
in classAggregationMethodDescriptor<MetricDescriptor>
- Parameters:
aggregationMethods
- the aggregation type methods for an entire time range- Returns:
- a reference to this object
-
getName
public java.lang.String getName()
Returns the untranslated nameDefault : null
- Returns:
- the untranslated name
-
setName
public MetricDescriptor setName(java.lang.String name)
Sets the untranslated name- Parameters:
name
- the name to set- Returns:
- a reference to this object
-
getUnits
public java.lang.String getUnits()
Returns the untranslated unitsDefault : null
- Returns:
- the untranslated units
-
setUnits
public MetricDescriptor setUnits(java.lang.String units)
Sets the untranslated units- Parameters:
units
- the units to set- Returns:
- a reference to this object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-