Skip to content

CloudWatchClient.get_metric_statistics

rboto-cloudwatch==0.4.0 · Service index · Types

Model summary (excerpt): Gets statistics for the specified metric. The maximum number of data points returned from a single call is 1,440. If you request more than 1,440 data points, CloudWatch returns an error. To reduce the number of data points, you can narrow the specified time range and make multiple requests across adjacent time ranges, or you can increase the specified period. Data points are not returned in...

Install and imports

python -m pip install "rboto[cloudwatch]==0.4.0"
from rboto import CloudWatchClient
from collections.abc import Sequence
from rboto_cloudwatch.types import (
    Dimension,
    GetMetricStatisticsOutput,
    StandardUnit,
    Statistic,
)

Signature

async def get_metric_statistics(
    *,
    namespace: str,
    metric_name: str,
    start_time: str,
    end_time: str,
    period: int,
    dimensions: Sequence[Dimension] | None = None,
    statistics: Sequence[Statistic] | None = None,
    extended_statistics: Sequence[str] | None = None,
    unit: StandardUnit | None = None,
) -> GetMetricStatisticsOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
namespace Yes The namespace of the metric, with or without spaces.
metric_name Yes The name of the metric, with or without spaces.
start_time Yes The time stamp that determines the first data point to return. Start times are evaluated relative to the time that CloudWatch receives the request. The value specified is inclusive; results include data points with the specified time stamp. In a raw HTTP query, the time stamp must be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z). CloudWatch rounds the specified time stamp as...
end_time Yes The time stamp that determines the last data point to return. The value specified is exclusive; results include data points up to the specified time stamp. In a raw HTTP query, the time stamp must be in ISO 8601 UTC format (for example, 2016-10-10T23:00:00Z).
period Yes The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a PutMetricData...
dimensions No The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension. CloudWatch treats each unique combination of dimensions as a separate metric. If a specific combination of dimensions was not published, you can't retrieve statistics for it. You must specify the same dimensions that were used when the metrics were created. For an example, see Dimension...
statistics No The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistics . When calling GetMetricStatistics , you must specify either Statistics or ExtendedStatistics , but not both.
extended_statistics No The percentile statistics. Specify values between p0.0 and p100. When calling GetMetricStatistics , you must specify either Statistics or ExtendedStatistics , but not both. Percentile statistics are not available for metrics when any of the metric values are negative numbers.
unit No The unit for a given metric. If you omit Unit , all data that was collected with any unit is returned, along with the corresponding units that were specified when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified. If you specify a unit that does not match the data collected, the results of the operation are...

Output

GetMetricStatisticsOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
label str | None Always present —
datapoints list[DatapointOutput] | None Always present DatapointOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

Dimension, GetMetricStatisticsOutput, StandardUnit, Statistic

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_cloudwatch.exceptions:

InternalServiceFaultError, InvalidParameterCombinationError, InvalidParameterValueError, MissingRequiredParameterError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model