CloudWatchClient.list_metrics
rboto-cloudwatch==0.4.0 · Service index · Types
Model summary (excerpt): List the specified metrics. You can use the returned metrics with GetMetricData or GetMetricStatistics to get 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 for the metric to appear. To see metric statistics sooner, use GetMetricData or...
Install and imports
from rboto import CloudWatchClient
from collections.abc import Sequence
from rboto_cloudwatch.types import (
DimensionFilter,
ListMetricsOutput,
RecentlyActive,
)
Signature
async def list_metrics(
*,
namespace: str | None = None,
metric_name: str | None = None,
dimensions: Sequence[DimensionFilter] | None = None,
next_token: str | None = None,
recently_active: RecentlyActive | None = None,
include_linked_accounts: bool | None = None,
owning_account: str | None = None,
) -> ListMetricsOutput: ...
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 |
No | The metric namespace to filter against. Only the namespace that matches exactly will be returned. |
metric_name |
No | The name of the metric to filter against. Only the metrics with names that match exactly will be returned. |
dimensions |
No | 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. |
next_token |
No | The token returned by a previous call to indicate that there is more data available. |
recently_active |
No | 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... |
include_linked_accounts |
No | 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 . |
owning_account |
No | 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 . |
Output
ListMetricsOutput.
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 |
|---|---|---|---|
metrics |
list[MetricOutput] | None |
Always present | MetricOutput |
next_token |
str | None |
Always present | — |
owning_accounts |
list[str] | None |
Always present | — |
| 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.
Related types
DimensionFilter, ListMetricsOutput, RecentlyActive
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
client.paginators.list_metrics(...) accepts the same arguments and returns AsyncIterator[ListMetricsOutput]. Direct calls return one page. Pages preserve the Output representation above.
Input cursors: next_token. Page-size argument: not exposed.
No output stream.
Errors
Import from rboto_cloudwatch.exceptions:
InternalServiceFaultError, InvalidParameterValueError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.