:doc:`ServiceResource <index>` / Collection / metrics

*******
metrics
*******



.. py:attribute:: CloudWatch.ServiceResource.metrics

  A collection of Metric resources.A Metric Collection will include all resources by default, and extreme caution should be taken when performing actions on all resources.

  .. py:method:: all()

    Creates an iterable of all Metric resources in the collection.

    See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics>`_    


    **Request Syntax**
    ::

      metric_iterator = cloudwatch.metrics.all()
      
      
    
    :rtype: list(:py:class:`cloudwatch.Metric`)
    :returns: A list of Metric resources
    

  .. py:method:: filter(**kwargs)

    Creates an iterable of all Metric resources in the collection filtered by kwargs passed to method. A Metric collection will include all resources by default if no filters are provided, and extreme caution should be taken when performing actions on all resources.

    See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics>`_    


    **Request Syntax**
    ::

      metric_iterator = cloudwatch.metrics.filter(
          Namespace='string',
          MetricName='string',
          Dimensions=[
              {
                  'Name': 'string',
                  'Value': 'string'
              },
          ],
          NextToken='string',
          RecentlyActive='PT3H',
          IncludeLinkedAccounts=True|False,
          OwningAccount='string'
      )
      
    :type Namespace: string
    :param Namespace: 

      The metric namespace to filter against. Only the namespace that matches exactly will be returned.

      

    
    :type MetricName: string
    :param MetricName: 

      The name of the metric to filter against. Only the metrics with names that match exactly will be returned.

      

    
    :type Dimensions: list
    :param Dimensions: 

      The dimensions to filter against. Only the dimension with names that match exactly will be returned. If you specify one dimension name and a metric has that dimension and also other dimensions, it will be returned.

      

    
      - *(dict) --* 

        Represents filters for a dimension.

        

      
        - **Name** *(string) --* **[REQUIRED]** 

          The dimension name to be matched.

          

        
        - **Value** *(string) --* 

          The value of the dimension to be matched.

          

        
      
  
    :type NextToken: string
    :param NextToken: 

      The token returned by a previous call to indicate that there is more data available.

      

    
    :type RecentlyActive: string
    :param RecentlyActive: 

      To filter the results to show only metrics that have had data points published in the past three hours, specify this parameter with a value of ``PT3H``. This is the only valid value for this parameter.

       

      The results that are returned are an approximation of the value you specify. There is a low probability that the returned results include metrics with last published data as much as 50 minutes more than the specified time interval.

      

    
    :type IncludeLinkedAccounts: boolean
    :param IncludeLinkedAccounts: 

      If you are using this operation in a monitoring account, specify ``true`` to include metrics from source accounts in the returned data.

       

      The default is ``false``.

      

    
    :type OwningAccount: string
    :param OwningAccount: 

      When you use this operation in a monitoring account, use this field to return metrics only from one source account. To do so, specify that source account ID in this field, and also specify ``true`` for ``IncludeLinkedAccounts``.

      

    
    
    :rtype: list(:py:class:`cloudwatch.Metric`)
    :returns: A list of Metric resources
    

  .. py:method:: limit(**kwargs)

    Creates an iterable up to a specified amount of Metric resources in the collection.

    See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics>`_    


    **Request Syntax**
    ::

      metric_iterator = cloudwatch.metrics.limit(
          count=123
      )
      
    :type count: integer
    :param count: The limit to the number of resources in the iterable.

    
    
    :rtype: list(:py:class:`cloudwatch.Metric`)
    :returns: A list of Metric resources
    

  .. py:method:: page_size(**kwargs)

    Creates an iterable of all Metric resources in the collection, but limits the number of items returned by each service call by the specified amount.

    See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics>`_    


    **Request Syntax**
    ::

      metric_iterator = cloudwatch.metrics.page_size(
          count=123
      )
      
    :type count: integer
    :param count: The number of items returned by each service call

    
    
    :rtype: list(:py:class:`cloudwatch.Metric`)
    :returns: A list of Metric resources
    