putAnomalyDetector method
Creates an anomaly detection model for a CloudWatch metric. You can use the model to display a band of expected normal values when the metric is graphed.
If you have enabled unified cross-account observability, and this account
is a monitoring account, the metric can be in the same account or a source
account. You can specify the account ID in the object you specify in the
SingleMetricAnomalyDetector parameter.
For more information, see CloudWatch Anomaly Detection.
May throw InternalServiceFault.
May throw InvalidParameterCombinationException.
May throw InvalidParameterValueException.
May throw LimitExceededException.
May throw MissingRequiredParameterException.
Parameter configuration :
The configuration specifies details about how the anomaly detection model
is to be trained, including time ranges to exclude when training and
updating the model. You can specify as many as 10 time ranges.
The configuration can also include the time zone to use for the metric.
Parameter dimensions :
The metric dimensions to create the anomaly detection model for.
Parameter metricCharacteristics :
Use this object to include parameters to provide information about your
metric to CloudWatch to help it build more accurate anomaly detection
models. Currently, it includes the PeriodicSpikes parameter.
Parameter metricMathAnomalyDetector :
The metric math anomaly detector to be created.
When using MetricMathAnomalyDetector, you cannot include the
following parameters in the same operation:
-
Dimensions -
MetricName -
Namespace -
Stat -
the
SingleMetricAnomalyDetectorparameters ofPutAnomalyDetectorInput
MetricMathAnomalyDetector.
Parameter metricName :
The name of the metric to create the anomaly detection model for.
Parameter namespace :
The namespace of the metric to create the anomaly detection model for.
Parameter singleMetricAnomalyDetector :
A single metric anomaly detector to be created.
When using SingleMetricAnomalyDetector, you cannot include
the following parameters in the same operation:
-
Dimensions -
MetricName -
Namespace -
Stat -
the
MetricMathAnomalyDetectorparameters ofPutAnomalyDetectorInput
SingleMetricAnomalyDetector.
Parameter stat :
The statistic to use for the metric and the anomaly detection model.
Implementation
Future<void> putAnomalyDetector({
AnomalyDetectorConfiguration? configuration,
List<Dimension>? dimensions,
MetricCharacteristics? metricCharacteristics,
MetricMathAnomalyDetector? metricMathAnomalyDetector,
String? metricName,
String? namespace,
SingleMetricAnomalyDetector? singleMetricAnomalyDetector,
String? stat,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'GraniteServiceVersion20100801.PutAnomalyDetector'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (configuration != null) 'Configuration': configuration,
if (dimensions != null) 'Dimensions': dimensions,
if (metricCharacteristics != null)
'MetricCharacteristics': metricCharacteristics,
if (metricMathAnomalyDetector != null)
'MetricMathAnomalyDetector': metricMathAnomalyDetector,
if (metricName != null) 'MetricName': metricName,
if (namespace != null) 'Namespace': namespace,
if (singleMetricAnomalyDetector != null)
'SingleMetricAnomalyDetector': singleMetricAnomalyDetector,
if (stat != null) 'Stat': stat,
},
);
}