Skip to content

Commit e0d291a

Browse files
author
awstools
committed
feat(client-cloudwatch): This release adds support for Metric Characteristics for CloudWatch Anomaly Detection. Anomaly Detector now takes Metric Characteristics object with Periodic Spikes boolean field that tells Anomaly Detection that spikes that repeat at the same time every week are part of the expected pattern.
1 parent 1061555 commit e0d291a

File tree

5 files changed

+104
-3
lines changed

5 files changed

+104
-3
lines changed

clients/client-cloudwatch/src/commands/DescribeAnomalyDetectorsCommand.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ export interface DescribeAnomalyDetectorsCommandOutput extends DescribeAnomalyDe
7979
* // MetricTimezone: "STRING_VALUE",
8080
* // },
8181
* // StateValue: "PENDING_TRAINING" || "TRAINED_INSUFFICIENT_DATA" || "TRAINED",
82+
* // MetricCharacteristics: { // MetricCharacteristics
83+
* // PeriodicSpikes: true || false,
84+
* // },
8285
* // SingleMetricAnomalyDetector: { // SingleMetricAnomalyDetector
8386
* // AccountId: "STRING_VALUE",
8487
* // Namespace: "STRING_VALUE",

clients/client-cloudwatch/src/commands/PutAnomalyDetectorCommand.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export interface PutAnomalyDetectorCommandOutput extends PutAnomalyDetectorOutpu
5858
* ],
5959
* MetricTimezone: "STRING_VALUE",
6060
* },
61+
* MetricCharacteristics: { // MetricCharacteristics
62+
* PeriodicSpikes: true || false,
63+
* },
6164
* SingleMetricAnomalyDetector: { // SingleMetricAnomalyDetector
6265
* AccountId: "STRING_VALUE",
6366
* Namespace: "STRING_VALUE",

clients/client-cloudwatch/src/models/models_0.ts

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,22 @@ export interface Dimension {
164164
Value: string | undefined;
165165
}
166166

167+
/**
168+
* <p>This object includes parameters that you can use to provide information to
169+
* CloudWatch to help it build more accurate anomaly detection models.</p>
170+
* @public
171+
*/
172+
export interface MetricCharacteristics {
173+
/**
174+
* <p>Set this parameter to <code>true</code> if values for this metric consistently include spikes
175+
* that should not be considered to be anomalies. With this set to <code>true</code>, CloudWatch will expect
176+
* to see spikes that occurred consistently during the model training period, and won't flag future similar spikes
177+
* as anomalies.</p>
178+
* @public
179+
*/
180+
PeriodicSpikes?: boolean;
181+
}
182+
167183
/**
168184
* <p>Represents a specific metric.</p>
169185
* @public
@@ -512,12 +528,19 @@ export interface AnomalyDetector {
512528
Configuration?: AnomalyDetectorConfiguration;
513529

514530
/**
515-
* <p>The current status of the anomaly detector's training. The possible values are <code>TRAINED | PENDING_TRAINING | TRAINED_INSUFFICIENT_DATA</code>
516-
* </p>
531+
* <p>The current status of the anomaly detector's training.</p>
517532
* @public
518533
*/
519534
StateValue?: AnomalyDetectorStateValue;
520535

536+
/**
537+
* <p>This object includes parameters that you can use to provide information about your metric to
538+
* CloudWatch to help it build more accurate anomaly detection models. Currently, it includes
539+
* the <code>PeriodicSpikes</code> parameter.</p>
540+
* @public
541+
*/
542+
MetricCharacteristics?: MetricCharacteristics;
543+
521544
/**
522545
* <p>The CloudWatch metric and statistic for this anomaly detector.</p>
523546
* @public
@@ -3445,6 +3468,14 @@ export interface PutAnomalyDetectorInput {
34453468
*/
34463469
Configuration?: AnomalyDetectorConfiguration;
34473470

3471+
/**
3472+
* <p>Use this object to include parameters to provide information about your metric to
3473+
* CloudWatch to help it build more accurate anomaly detection models. Currently, it includes
3474+
* the <code>PeriodicSpikes</code> parameter.</p>
3475+
* @public
3476+
*/
3477+
MetricCharacteristics?: MetricCharacteristics;
3478+
34483479
/**
34493480
* <p>A single metric anomaly detector to be created.</p>
34503481
* <p>When using <code>SingleMetricAnomalyDetector</code>,

clients/client-cloudwatch/src/protocols/Aws_query.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ import {
180180
MessageData,
181181
Metric,
182182
MetricAlarm,
183+
MetricCharacteristics,
183184
MetricDataQuery,
184185
MetricDataResult,
185186
MetricDatum,
@@ -2771,6 +2772,17 @@ const se_Metric = (input: Metric, context: __SerdeContext): any => {
27712772
return entries;
27722773
};
27732774

2775+
/**
2776+
* serializeAws_queryMetricCharacteristics
2777+
*/
2778+
const se_MetricCharacteristics = (input: MetricCharacteristics, context: __SerdeContext): any => {
2779+
const entries: any = {};
2780+
if (input[_PS] != null) {
2781+
entries[_PS] = input[_PS];
2782+
}
2783+
return entries;
2784+
};
2785+
27742786
/**
27752787
* serializeAws_queryMetricData
27762788
*/
@@ -3152,6 +3164,13 @@ const se_PutAnomalyDetectorInput = (input: PutAnomalyDetectorInput, context: __S
31523164
entries[loc] = value;
31533165
});
31543166
}
3167+
if (input[_MC] != null) {
3168+
const memberEntries = se_MetricCharacteristics(input[_MC], context);
3169+
Object.entries(memberEntries).forEach(([key, value]) => {
3170+
const loc = `MetricCharacteristics.${key}`;
3171+
entries[loc] = value;
3172+
});
3173+
}
31553174
if (input[_SMAD] != null) {
31563175
const memberEntries = se_SingleMetricAnomalyDetector(input[_SMAD], context);
31573176
Object.entries(memberEntries).forEach(([key, value]) => {
@@ -3818,6 +3837,9 @@ const de_AnomalyDetector = (output: any, context: __SerdeContext): AnomalyDetect
38183837
if (output[_SV] != null) {
38193838
contents[_SV] = __expectString(output[_SV]);
38203839
}
3840+
if (output[_MC] != null) {
3841+
contents[_MC] = de_MetricCharacteristics(output[_MC], context);
3842+
}
38213843
if (output[_SMAD] != null) {
38223844
contents[_SMAD] = de_SingleMetricAnomalyDetector(output[_SMAD], context);
38233845
}
@@ -4939,6 +4961,17 @@ const de_MetricAlarms = (output: any, context: __SerdeContext): MetricAlarm[] =>
49394961
});
49404962
};
49414963

4964+
/**
4965+
* deserializeAws_queryMetricCharacteristics
4966+
*/
4967+
const de_MetricCharacteristics = (output: any, context: __SerdeContext): MetricCharacteristics => {
4968+
const contents: any = {};
4969+
if (output[_PS] != null) {
4970+
contents[_PS] = __parseBoolean(output[_PS]);
4971+
}
4972+
return contents;
4973+
};
4974+
49424975
/**
49434976
* deserializeAws_queryMetricDataQueries
49444977
*/
@@ -5626,6 +5659,7 @@ const _LTFR = "ListTagsForResource";
56265659
const _LUD = "LastUpdateDate";
56275660
const _M = "Metrics";
56285661
const _MA = "MetricAlarms";
5662+
const _MC = "MetricCharacteristics";
56295663
const _MCC = "MaxContributorCount";
56305664
const _MCV = "MaxContributorValue";
56315665
const _MD = "MaxDatapoints";
@@ -5668,6 +5702,7 @@ const _PMD = "PutMetricData";
56685702
const _PMIR = "PutManagedInsightRules";
56695703
const _PMS = "PutMetricStream";
56705704
const _POAN = "ParentsOfAlarmName";
5705+
const _PS = "PeriodicSpikes";
56715706
const _RA = "RecentlyActive";
56725707
const _RARN = "ResourceARN";
56735708
const _RAo = "RoleArn";

codegen/sdk-codegen/aws-models/cloudwatch.json

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,13 @@
269269
"StateValue": {
270270
"target": "com.amazonaws.cloudwatch#AnomalyDetectorStateValue",
271271
"traits": {
272-
"smithy.api#documentation": "<p>The current status of the anomaly detector's training. The possible values are <code>TRAINED | PENDING_TRAINING | TRAINED_INSUFFICIENT_DATA</code>\n </p>"
272+
"smithy.api#documentation": "<p>The current status of the anomaly detector's training.</p>"
273+
}
274+
},
275+
"MetricCharacteristics": {
276+
"target": "com.amazonaws.cloudwatch#MetricCharacteristics",
277+
"traits": {
278+
"smithy.api#documentation": "<p>This object includes parameters that you can use to provide information about your metric to \n\t\t\tCloudWatch to help it build more accurate anomaly detection models. Currently, it includes\n\t\t\tthe <code>PeriodicSpikes</code> parameter.</p>"
273279
}
274280
},
275281
"SingleMetricAnomalyDetector": {
@@ -4838,6 +4844,20 @@
48384844
"target": "com.amazonaws.cloudwatch#MetricAlarm"
48394845
}
48404846
},
4847+
"com.amazonaws.cloudwatch#MetricCharacteristics": {
4848+
"type": "structure",
4849+
"members": {
4850+
"PeriodicSpikes": {
4851+
"target": "com.amazonaws.cloudwatch#PeriodicSpikes",
4852+
"traits": {
4853+
"smithy.api#documentation": "<p>Set this parameter to <code>true</code> if values for this metric consistently include spikes\n\t\t\tthat should not be considered to be anomalies. With this set to <code>true</code>, CloudWatch will expect \n\t\t\tto see spikes that occurred consistently during the model training period, and won't flag future similar spikes\n\t\t\tas anomalies.</p>"
4854+
}
4855+
}
4856+
},
4857+
"traits": {
4858+
"smithy.api#documentation": "<p>This object includes parameters that you can use to provide information to \n\t\t\tCloudWatch to help it build more accurate anomaly detection models.</p>"
4859+
}
4860+
},
48414861
"com.amazonaws.cloudwatch#MetricData": {
48424862
"type": "list",
48434863
"member": {
@@ -5402,6 +5422,9 @@
54025422
}
54035423
}
54045424
},
5425+
"com.amazonaws.cloudwatch#PeriodicSpikes": {
5426+
"type": "boolean"
5427+
},
54055428
"com.amazonaws.cloudwatch#PutAnomalyDetector": {
54065429
"type": "operation",
54075430
"input": {
@@ -5476,6 +5499,12 @@
54765499
"smithy.api#documentation": "<p>The configuration specifies details about how the \n\t\t\tanomaly detection model is to be trained, including \n\t\t\ttime ranges to exclude when training and updating the model.\n\t\t\tYou can specify as many as 10 time ranges.</p>\n <p>The configuration can also include the time zone to use for \n\t\t\tthe metric.</p>"
54775500
}
54785501
},
5502+
"MetricCharacteristics": {
5503+
"target": "com.amazonaws.cloudwatch#MetricCharacteristics",
5504+
"traits": {
5505+
"smithy.api#documentation": "<p>Use this object to include parameters to provide information about your metric to \n\t\t\tCloudWatch to help it build more accurate anomaly detection models. Currently, it includes\n\t\t\tthe <code>PeriodicSpikes</code> parameter.</p>"
5506+
}
5507+
},
54795508
"SingleMetricAnomalyDetector": {
54805509
"target": "com.amazonaws.cloudwatch#SingleMetricAnomalyDetector",
54815510
"traits": {

0 commit comments

Comments
 (0)