Class Metric

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class Metric
    extends Object
    implements Serializable, 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.

    See Also:
    Serialized Form
    • Constructor Detail

      • Metric

        public Metric()
    • Method Detail

      • setNamespace

        public void setNamespace​(String namespace)

        The namespace of the metric.

        Parameters:
        namespace - The namespace of the metric.
      • getNamespace

        public String getNamespace()

        The namespace of the metric.

        Returns:
        The namespace of the metric.
      • withNamespace

        public Metric withNamespace​(String namespace)

        The namespace of the metric.

        Parameters:
        namespace - The namespace of the metric.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • setMetricName

        public void setMetricName​(String metricName)

        The name of the metric.

        Parameters:
        metricName - The name of the metric.
      • getMetricName

        public String getMetricName()

        The name of the metric.

        Returns:
        The name of the metric.
      • withMetricName

        public Metric withMetricName​(String metricName)

        The name of the metric.

        Parameters:
        metricName - The name of the metric.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • getDimensions

        public List<Dimension> getDimensions()

        A list of dimensions associated with the metric.

        Returns:
        A list of dimensions associated with the metric.
      • setDimensions

        public void setDimensions​(Collection<Dimension> dimensions)

        A list of dimensions associated with the metric.

        Parameters:
        dimensions - A list of dimensions associated with the metric.
      • withDimensions

        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.

        Parameters:
        dimensions - A list of dimensions associated with the metric.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • withDimensions

        public Metric withDimensions​(Collection<Dimension> dimensions)

        A list of dimensions associated with the metric.

        Parameters:
        dimensions - A list of dimensions associated with the metric.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • toString

        public String toString()
        Returns a string representation of this object; useful for testing and debugging.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this object.
        See Also:
        Object.toString()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object