PrometheusService / Client / create_anomaly_detector
create_anomaly_detector¶
- PrometheusService.Client.create_anomaly_detector(**kwargs)¶
Creates an anomaly detector within a workspace using the Random Cut Forest algorithm for time-series analysis. The anomaly detector analyzes Amazon Managed Service for Prometheus metrics to identify unusual patterns and behaviors.
See also: AWS API Documentation
Request Syntax
response = client.create_anomaly_detector( workspaceId='string', alias='string', evaluationIntervalInSeconds=123, missingDataAction={ 'markAsAnomaly': True|False, 'skip': True|False }, configuration={ 'randomCutForest': { 'query': 'string', 'shingleSize': 123, 'sampleSize': 123, 'ignoreNearExpectedFromAbove': { 'amount': 123.0, 'ratio': 123.0 }, 'ignoreNearExpectedFromBelow': { 'amount': 123.0, 'ratio': 123.0 } } }, labels={ 'string': 'string' }, clientToken='string', tags={ 'string': 'string' } )
- Parameters:
workspaceId (string) –
[REQUIRED]
The identifier of the workspace where the anomaly detector will be created.
alias (string) –
[REQUIRED]
A user-friendly name for the anomaly detector.
evaluationIntervalInSeconds (integer) – The frequency, in seconds, at which the anomaly detector evaluates metrics. The default value is 60 seconds.
missingDataAction (dict) –
Specifies the action to take when data is missing during evaluation.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
markAsAnomaly,skip.markAsAnomaly (boolean) –
Marks missing data points as anomalies.
skip (boolean) –
Skips evaluation when data is missing.
configuration (dict) –
[REQUIRED]
The algorithm configuration for the anomaly detector.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
randomCutForest.randomCutForest (dict) –
The Random Cut Forest algorithm configuration for anomaly detection.
query (string) – [REQUIRED]
The Prometheus query used to retrieve the time-series data for anomaly detection.
Warning
Random Cut Forest queries must be wrapped by a supported PromQL aggregation operator. For more information, see Aggregation operators on the Prometheus docs website.
Supported PromQL aggregation operators:
avg,count,group,max,min,quantile,stddev,stdvar, andsum.shingleSize (integer) –
The number of consecutive data points used to create a shingle for the Random Cut Forest algorithm. The default number is 8 consecutive data points.
sampleSize (integer) –
The number of data points sampled from the input stream for the Random Cut Forest algorithm. The default number is 256 consecutive data points.
ignoreNearExpectedFromAbove (dict) –
Configuration for ignoring values that are near expected values from above during anomaly detection.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
amount,ratio.amount (float) –
The absolute amount by which values can differ from expected values before being considered anomalous.
ratio (float) –
The ratio by which values can differ from expected values before being considered anomalous.
ignoreNearExpectedFromBelow (dict) –
Configuration for ignoring values that are near expected values from below during anomaly detection.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
amount,ratio.amount (float) –
The absolute amount by which values can differ from expected values before being considered anomalous.
ratio (float) –
The ratio by which values can differ from expected values before being considered anomalous.
labels (dict) –
The Amazon Managed Service for Prometheus metric labels to associate with the anomaly detector.
(string) –
(string) –
clientToken (string) –
A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
This field is autopopulated if not provided.
tags (dict) –
The metadata to apply to the anomaly detector to assist with categorization and organization.
(string) –
The key of the tag. Must not begin with
aws:.(string) –
The value of the tag.
- Return type:
dict
- Returns:
Response Syntax
{ 'anomalyDetectorId': 'string', 'arn': 'string', 'status': { 'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED', 'statusReason': 'string' }, 'tags': { 'string': 'string' } }
Response Structure
(dict) –
anomalyDetectorId (string) –
The unique identifier of the created anomaly detector.
arn (string) –
The Amazon Resource Name (ARN) of the created anomaly detector.
status (dict) –
The status information of the created anomaly detector.
statusCode (string) –
The status code of the anomaly detector.
statusReason (string) –
A description of the current status of the anomaly detector.
tags (dict) –
The tags applied to the created anomaly detector.
(string) –
The key of the tag. Must not begin with
aws:.(string) –
The value of the tag.
Exceptions
PrometheusService.Client.exceptions.ThrottlingExceptionPrometheusService.Client.exceptions.ConflictExceptionPrometheusService.Client.exceptions.ValidationExceptionPrometheusService.Client.exceptions.AccessDeniedExceptionPrometheusService.Client.exceptions.InternalServerExceptionPrometheusService.Client.exceptions.ServiceQuotaExceededException