list_anomalies
async
¶
list_anomalies(
*,
config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
time_range: Optional[IntelligenceTimeRange] = None,
services: Optional[IntelligenceServiceNameList] = None,
signal_types: Optional[AnomalySignalTypeList] = None,
max_results: Optional[int] = None,
next_token: Optional[PaginationToken] = None,
severity: Optional[Severity] = None,
source_account_id: Optional[SourceAccountIdList] = None,
anomaly_ids: Optional[AnomalyIdList] = None,
) -> ListAnomaliesOutput
This operation is part of Observations, which is in preview release for Amazon CloudWatch Omni and is subject to change. Retrieves the anomalies matching the given filters.
Parameters:
-
time_range(Optional[IntelligenceTimeRange], default:None) –Time window to scope the anomaly search.
-
services(Optional[IntelligenceServiceNameList], default:None) –Filter by service names.
-
signal_types(Optional[AnomalySignalTypeList], default:None) –Filter by signal types (e.g. logs, metrics, traces).
-
max_results(Optional[int], default:None) –Maximum number of anomalies to return per page.
-
next_token(Optional[PaginationToken], default:None) –Pagination token from a previous response.
-
severity(Optional[Severity], default:None) –Filter by severity level. Anomaly severities are lowercase, so send "high", not "HIGH". One level only; there is no severity list and no minimum-severity filter.
-
source_account_id(Optional[SourceAccountIdList], default:None) –Filter by the accounts that produced the signal.
-
anomaly_ids(Optional[AnomalyIdList], default:None) –Optional batch-get filter. When set, anomalies are fetched by ID under the caller's account. Pagination still applies: maxResults bounds the returned anomalies per page; nextToken cursors through the input ID list. An ID that does not exist, or that the caller is not permitted to read, is omitted from items; compare the IDs you requested against the IDs returned across all pages to find them. anomalyIds is mutually exclusive with the other filters (timeRange, services, signalTypes, severity, sourceAccountId) — passing any of them alongside anomalyIds returns a ValidationException. Use a follow-up ListAnomalies call without anomalyIds for filtered queries.
Raises:
-
AccessDeniedException–The caller is not authorized to perform this action.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ThrottlingException–The request was throttled due to exceeding the allowed request rate.
-
ValidationException–A parameter is specified incorrectly.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
List high-severity log anomalies for a service The following example lists the high-severity anomalies detected in the logs of one service over a one-hour window. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.list_anomalies(time_range={'start': '2026-09-16T00:00:00Z', 'end': '2026-09-16T01:00:00Z'}, services=['checkout-service'], signal_types=['logs'], severity='high', max_results=25)
Retrieve anomalies by ID
The following example retrieves two anomalies by their IDs, for example the anomalies an observation correlates. An ID that does not exist or that the caller cannot read is left out of the response. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.list_anomalies(anomaly_ids=['3f6c1a4b8e0d2f5a7c9e1b3d5f7a9c0e2b4d6f8a0c2e4a6b8d0f2a4c6e8b0d2f', '7b2e4d6f8a0c1e3a5c7e9b1d3f5a7c9e0b2d4f6a8c0e2a4c6e8b0d2f4a6c8e0b'])
Read what accounted for a trace anomaly
The following example lists trace anomalies for a service. Each occurrence states what it measured and what accounted for the anomalous excess. The error rate carries no statistic because nothing aggregated it in CloudWatch's sense — it is a ratio the detector derived from counts. The shares have different bases and must not be summed across dimensions: a tool share is a share of the anomalous excess, while an error-class share is a share of the total failures. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.list_anomalies(time_range={'start': '2026-09-16T00:00:00Z', 'end': '2026-09-16T01:00:00Z'}, services=['payments-service'], signal_types=['traces'], max_results=25)
Read a metric anomaly, including one that measures no figure
The following example lists metric anomalies. The first states the figure it compared, in the unit CloudWatch published the metric as; a metric occurrence carries no quantity, because the anomaly already names the metric. The second is a presence anomaly: it measures nothing, so it carries no measurement at all, and what it found is in signalDetails instead. Both still state the window their findings cover. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.list_anomalies(time_range={'start': '2026-09-16T00:00:00Z', 'end': '2026-09-16T01:00:00Z'}, signal_types=['metrics'], max_results=25)
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 | |