public class Metric extends Object implements Serializable
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.
| Constructor and Description |
|---|
Metric() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
List<Dimension> |
getDimensions()
A list of dimensions associated with the metric.
|
String |
getMetricName()
The name of the metric.
|
String |
getNamespace()
The namespace of the metric.
|
int |
hashCode() |
void |
setDimensions(Collection<Dimension> dimensions)
A list of dimensions associated with the metric.
|
void |
setMetricName(String metricName)
The name of the metric.
|
void |
setNamespace(String namespace)
The namespace of the metric.
|
String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
Metric |
withDimensions(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(String metricName)
The name of the metric.
|
Metric |
withNamespace(String namespace)
The namespace of the metric.
|
public String getNamespace()
Constraints:
Length: 1 - 255
Pattern: [^:].*
public void setNamespace(String namespace)
Constraints:
Length: 1 - 255
Pattern: [^:].*
namespace - The namespace of the metric.public Metric withNamespace(String namespace)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 255
Pattern: [^:].*
namespace - The namespace of the metric.public String getMetricName()
Constraints:
Length: 1 - 255
public void setMetricName(String metricName)
Constraints:
Length: 1 - 255
metricName - The name of the metric.public Metric withMetricName(String metricName)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 255
metricName - The name of the metric.public List<Dimension> getDimensions()
Constraints:
Length: 0 - 10
public void setDimensions(Collection<Dimension> dimensions)
Constraints:
Length: 0 - 10
dimensions - A list of dimensions associated with the metric.public Metric withDimensions(Dimension... dimensions)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 0 - 10
dimensions - A list of dimensions associated with the metric.public Metric withDimensions(Collection<Dimension> dimensions)
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 0 - 10
dimensions - A list of dimensions associated with the metric.public String toString()
toString in class ObjectObject.toString()Copyright © 2016. All rights reserved.