AnomalyDetector
Source:
src/AWS/CloudWatch/AnomalyDetector.ts
A CloudWatch anomaly detector — trains a model on a metric’s historical
data and computes an expected-value band, which alarms can use via the
ANOMALY_DETECTION_BAND metric-math function.
Creating Detectors
Section titled “Creating Detectors”Single Metric Detector
const detector = yield* AnomalyDetector("ErrorsDetector", { Namespace: "AWS/Lambda", MetricName: "Errors", Stat: "Sum",});Detector on a Custom Metric
// pair with PutMetricData publishing to the same namespace/metricconst detector = yield* AnomalyDetector("PaymentsDetector", { Namespace: "MyApp/Payments", MetricName: "PaymentProcessed", Stat: "Sum",});Reading Detectors at Runtime
Section titled “Reading Detectors at Runtime”// init — see DescribeAnomalyDetectorsconst describeAnomalyDetectors = yield* AWS.CloudWatch.DescribeAnomalyDetectors();
// runtimeconst result = yield* describeAnomalyDetectors({ Namespace: "MyApp/Payments" });