public class Metric
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
The Metric
data type contains information about a specific
metric. If you call ListMetrics, Amazon CloudWatch returns information
contained by this data type.
The example in the Examples section publishes two metrics named buffers and latency. Both metrics are in the examples namespace. Both metrics have two dimensions, InstanceID and InstanceType.
Modifier and Type | Field and Description |
---|---|
private SdkInternalList<Dimension> |
dimensions
A list of dimensions associated with the metric.
|
private java.lang.String |
metricName
The name of the metric.
|
private java.lang.String |
namespace
The namespace of the metric.
|
Constructor and Description |
---|
Metric() |
Modifier and Type | Method and Description |
---|---|
Metric |
clone() |
boolean |
equals(java.lang.Object obj) |
java.util.List<Dimension> |
getDimensions()
A list of dimensions associated with the metric.
|
java.lang.String |
getMetricName()
The name of the metric.
|
java.lang.String |
getNamespace()
The namespace of the metric.
|
int |
hashCode() |
void |
setDimensions(java.util.Collection<Dimension> dimensions)
A list of dimensions associated with the metric.
|
void |
setMetricName(java.lang.String metricName)
The name of the metric.
|
void |
setNamespace(java.lang.String namespace)
The namespace of the metric.
|
java.lang.String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
Metric |
withDimensions(java.util.Collection<Dimension> dimensions)
A list of dimensions associated with the metric.
|
Metric |
withDimensions(Dimension... dimensions)
A list of dimensions associated with the metric.
|
Metric |
withMetricName(java.lang.String metricName)
The name of the metric.
|
Metric |
withNamespace(java.lang.String namespace)
The namespace of the metric.
|
private java.lang.String namespace
The namespace of the metric.
private java.lang.String metricName
The name of the metric.
private SdkInternalList<Dimension> dimensions
A list of dimensions associated with the metric.
public void setNamespace(java.lang.String namespace)
The namespace of the metric.
namespace
- The namespace of the metric.public java.lang.String getNamespace()
The namespace of the metric.
public Metric withNamespace(java.lang.String namespace)
The namespace of the metric.
namespace
- The namespace of the metric.public void setMetricName(java.lang.String metricName)
The name of the metric.
metricName
- The name of the metric.public java.lang.String getMetricName()
The name of the metric.
public Metric withMetricName(java.lang.String metricName)
The name of the metric.
metricName
- The name of the metric.public java.util.List<Dimension> getDimensions()
A list of dimensions associated with the metric.
public void setDimensions(java.util.Collection<Dimension> dimensions)
A list of dimensions associated with the metric.
dimensions
- A list of dimensions associated with the metric.public Metric withDimensions(Dimension... dimensions)
A list of dimensions associated with the metric.
NOTE: This method appends the values to the existing list (if
any). Use setDimensions(java.util.Collection)
or
withDimensions(java.util.Collection)
if you want to override the
existing values.
dimensions
- A list of dimensions associated with the metric.public Metric withDimensions(java.util.Collection<Dimension> dimensions)
A list of dimensions associated with the metric.
dimensions
- A list of dimensions associated with the metric.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public Metric clone()
clone
in class java.lang.Object