Amazon CloudWatch

2020/07/24 - Amazon CloudWatch - 1 updated api methods

Changes  AWS CloudWatch ListMetrics now supports an optional parameter (RecentlyActive) to filter results by only metrics that have received new datapoints in the past 3 hours. This enables more targeted metric data retrieval through the Get APIs

ListMetrics (updated) Link ΒΆ
Changes (request)
{'RecentlyActive': 'PT3H'}

List the specified metrics. You can use the returned metrics with GetMetricData or GetMetricStatistics to obtain statistical data.

Up to 500 results are returned for any one call. To retrieve additional results, use the returned token with subsequent calls.

After you create a metric, allow up to 15 minutes before the metric appears. You can see statistics about the metric sooner by using GetMetricData or GetMetricStatistics .

ListMetrics doesn't return information about metrics if those metrics haven't reported data in the past two weeks. To retrieve those metrics, use GetMetricData or GetMetricStatistics .

See also: AWS API Documentation

Request Syntax

client.list_metrics(
    Namespace='string',
    MetricName='string',
    Dimensions=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    NextToken='string',
    RecentlyActive='PT3H'
)
type Namespace

string

param Namespace

The namespace to filter against.

type MetricName

string

param MetricName

The name of the metric to filter against.

type Dimensions

list

param Dimensions

The dimensions to filter against.

  • (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 40 minutes more than the specified time interval.

rtype

dict

returns

Response Syntax

{
    'Metrics': [
        {
            'Namespace': 'string',
            'MetricName': 'string',
            'Dimensions': [
                {
                    'Name': 'string',
                    'Value': 'string'
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Metrics (list) --

      The metrics that match your request.

      • (dict) --

        Represents a specific metric.

        • Namespace (string) --

          The namespace of the metric.

        • MetricName (string) --

          The name of the metric. This is a required field.

        • Dimensions (list) --

          The dimensions for the metric.

          • (dict) --

            A dimension is a name/value pair that is part of the identity of a metric. You can assign up to 10 dimensions to a metric. Because dimensions are part of the unique identifier for a metric, whenever you add a unique name/value pair to one of your metrics, you are creating a new variation of that metric.

            • Name (string) --

              The name of the dimension. Dimension names cannot contain blank spaces or non-ASCII characters.

            • Value (string) --

              The value of the dimension.

    • NextToken (string) --

      The token that marks the start of the next batch of returned results.