|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
org.apache.hadoop.metrics2
usage.
@Deprecated @InterfaceAudience.Private @InterfaceStability.Evolving public interface MetricsRecord
A named and optionally tagged set of records to be sent to the metrics system.
A record name identifies the kind of data to be reported. For example, a program reporting statistics relating to the disks on a computer might use a record name "diskStats". A record has zero or more tags. A tag has a name and a value. To continue the example, the "diskStats" record might use a tag named "diskName" to identify a particular disk. Sometimes it is useful to have more than one tag, so there might also be a "diskType" with value "ide" or "scsi" or whatever. A record also has zero or more metrics. These are the named values that are to be reported to the metrics system. In the "diskStats" example, possible metric names would be "diskPercentFull", "diskPercentBusy", "kbReadPerSecond", etc. The general procedure for using a MetricsRecord is to fill in its tag and metric values, and then callupdate()
to pass the record to the
client library.
Metric data is not immediately sent to the metrics system
each time that update()
is called.
An internal table is maintained, identified by the record name. This
table has columns
corresponding to the tag and the metric names, and rows
corresponding to each unique set of tag values. An update
either modifies an existing row in the table, or adds a new row with a set of
tag values that are different from all the other rows. Note that if there
are no tags, then there can be at most one row in the table.
Once a row is added to the table, its data will be sent to the metrics system
on every timer period, whether or not it has been updated since the previous
timer period. If this is inappropriate, for example if metrics were being
reported by some transient object in an application, the remove()
method can be used to remove the row and thus stop the data from being
sent.
Note that the update()
method is atomic. This means that it is
safe for different threads to be updating the same metric. More precisely,
it is OK for different threads to call update()
on MetricsRecord instances
with the same set of tag names and tag values. Different threads should
not use the same MetricsRecord instance at the same time.
Method Summary | |
---|---|
String |
getRecordName()
Deprecated. Returns the record name. |
void |
incrMetric(String metricName,
byte metricValue)
Deprecated. Increments the named metric by the specified value. |
void |
incrMetric(String metricName,
float metricValue)
Deprecated. Increments the named metric by the specified value. |
void |
incrMetric(String metricName,
int metricValue)
Deprecated. Increments the named metric by the specified value. |
void |
incrMetric(String metricName,
long metricValue)
Deprecated. Increments the named metric by the specified value. |
void |
incrMetric(String metricName,
short metricValue)
Deprecated. Increments the named metric by the specified value. |
void |
remove()
Deprecated. Removes, from the buffered data table, all rows having tags that equal the tags that have been set on this record. |
void |
removeTag(String tagName)
Deprecated. Removes any tag of the specified name. |
void |
setMetric(String metricName,
byte metricValue)
Deprecated. Sets the named metric to the specified value. |
void |
setMetric(String metricName,
float metricValue)
Deprecated. Sets the named metric to the specified value. |
void |
setMetric(String metricName,
int metricValue)
Deprecated. Sets the named metric to the specified value. |
void |
setMetric(String metricName,
long metricValue)
Deprecated. Sets the named metric to the specified value. |
void |
setMetric(String metricName,
short metricValue)
Deprecated. Sets the named metric to the specified value. |
void |
setTag(String tagName,
byte tagValue)
Deprecated. Sets the named tag to the specified value. |
void |
setTag(String tagName,
int tagValue)
Deprecated. Sets the named tag to the specified value. |
void |
setTag(String tagName,
long tagValue)
Deprecated. Sets the named tag to the specified value. |
void |
setTag(String tagName,
short tagValue)
Deprecated. Sets the named tag to the specified value. |
void |
setTag(String tagName,
String tagValue)
Deprecated. Sets the named tag to the specified value. |
void |
update()
Deprecated. Updates the table of buffered data which is to be sent periodically. |
Method Detail |
---|
String getRecordName()
void setTag(String tagName, String tagValue)
tagName
- name of the tagtagValue
- new value of the tag
MetricsException
- if the tagName conflicts with the configurationvoid setTag(String tagName, int tagValue)
tagName
- name of the tagtagValue
- new value of the tag
MetricsException
- if the tagName conflicts with the configurationvoid setTag(String tagName, long tagValue)
tagName
- name of the tagtagValue
- new value of the tag
MetricsException
- if the tagName conflicts with the configurationvoid setTag(String tagName, short tagValue)
tagName
- name of the tagtagValue
- new value of the tag
MetricsException
- if the tagName conflicts with the configurationvoid setTag(String tagName, byte tagValue)
tagName
- name of the tagtagValue
- new value of the tag
MetricsException
- if the tagName conflicts with the configurationvoid removeTag(String tagName)
tagName
- name of a tagvoid setMetric(String metricName, int metricValue)
metricName
- name of the metricmetricValue
- new value of the metric
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid setMetric(String metricName, long metricValue)
metricName
- name of the metricmetricValue
- new value of the metric
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid setMetric(String metricName, short metricValue)
metricName
- name of the metricmetricValue
- new value of the metric
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid setMetric(String metricName, byte metricValue)
metricName
- name of the metricmetricValue
- new value of the metric
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid setMetric(String metricName, float metricValue)
metricName
- name of the metricmetricValue
- new value of the metric
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid incrMetric(String metricName, int metricValue)
metricName
- name of the metricmetricValue
- incremental value
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid incrMetric(String metricName, long metricValue)
metricName
- name of the metricmetricValue
- incremental value
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid incrMetric(String metricName, short metricValue)
metricName
- name of the metricmetricValue
- incremental value
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid incrMetric(String metricName, byte metricValue)
metricName
- name of the metricmetricValue
- incremental value
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid incrMetric(String metricName, float metricValue)
metricName
- name of the metricmetricValue
- incremental value
MetricsException
- if the metricName or the type of the metricValue
conflicts with the configurationvoid update()
void remove()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |