Skip to content

Commit 58e3a94

Browse files
author
awstools
committed
feat(client-cloudwatch): Adds support for additional statistics in CloudWatch Metric Streams.
1 parent 2f160df commit 58e3a94

File tree

7 files changed

+467
-29
lines changed

7 files changed

+467
-29
lines changed

clients/client-cloudwatch/src/CloudWatch.ts

+29-4
Original file line numberDiff line numberDiff line change
@@ -782,13 +782,21 @@ export class CloudWatch extends CloudWatchClient {
782782
}
783783

784784
/**
785-
* <p>You can use the <code>GetMetricData</code> API to retrieve as many as 500 different
785+
* <p>You can use the <code>GetMetricData</code> API to retrieve CloudWatch metric values. The operation
786+
* can also include a CloudWatch Metrics Insights query, and one or more metric math functions.</p>
787+
* <p>A <code>GetMetricData</code> operation that does not include a query can retrieve as many as 500 different
786788
* metrics in a single request, with a total of as many as 100,800 data points. You can also
787-
* optionally perform math expressions on the values of the returned statistics, to create
789+
* optionally perform metric math expressions on the values of the returned statistics, to create
788790
* new time series that represent new insights into your data. For example, using Lambda
789791
* metrics, you could divide the Errors metric by the Invocations metric to get an error
790792
* rate time series. For more information about metric math expressions, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax">Metric Math Syntax and Functions</a> in the <i>Amazon CloudWatch User
791-
* Guide</i>.</p>
793+
* Guide</i>.</p>
794+
*
795+
*
796+
* <p>If you include a Metrics Insights query, each <code>GetMetricData</code> operation can include only one
797+
* query. But the same <code>GetMetricData</code> operation can also retrieve other metrics. Metrics Insights queries
798+
* can query only the most recent three hours of metric data. For more information about Metrics Insights,
799+
* see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/query_with_cloudwatch-metrics-insights.html">Query your metrics with CloudWatch Metrics Insights</a>.</p>
792800
*
793801
* <p>Calls to the <code>GetMetricData</code> API have a different pricing structure than
794802
* calls to <code>GetMetricStatistics</code>. For more information about pricing, see
@@ -818,6 +826,16 @@ export class CloudWatch extends CloudWatchClient {
818826
* <p>If you omit <code>Unit</code> in your request, all data that was collected with any unit is returned, along with the corresponding units that were specified
819827
* when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified.
820828
* If you specify a unit that does not match the data collected, the results of the operation are null. CloudWatch does not perform unit conversions.</p>
829+
*
830+
* <p>
831+
* <b>Using Metrics Insights queries with metric math</b>
832+
* </p>
833+
* <p>You can't mix a Metric Insights query and metric math syntax in the same expression, but
834+
* you can reference results from a Metrics Insights query within other Metric math expressions. A Metrics Insights
835+
* query without a <b>GROUP BY</b> clause returns a single time-series (TS),
836+
* and can be used as input for a metric math expression that expects a single time series. A Metrics Insights
837+
* query with a <b>GROUP BY</b> clause returns an array of time-series (TS[]),
838+
* and can be used as input for a metric math expression that expects an array of time series. </p>
821839
*/
822840
public getMetricData(
823841
args: GetMetricDataCommandInput,
@@ -1196,7 +1214,8 @@ export class CloudWatch extends CloudWatchClient {
11961214
* states of other alarms that you have created. The composite alarm goes into ALARM state
11971215
* only if all conditions of the rule are met.</p>
11981216
* <p>The alarms specified in a composite alarm's rule expression can include metric alarms
1199-
* and other composite alarms.</p>
1217+
* and other composite alarms. The rule expression of a composite alarm can include as many as 100 underlying alarms.
1218+
* Any single alarm can be included in the rule expressions of as many as 150 composite alarms.</p>
12001219
* <p>Using composite alarms can reduce
12011220
* alarm noise. You can create multiple metric alarms,
12021221
* and also create a composite alarm and
@@ -1536,6 +1555,12 @@ export class CloudWatch extends CloudWatchClient {
15361555
* </li>
15371556
* </ul>
15381557
*
1558+
* <p>By default, a metric stream always sends the <code>MAX</code>, <code>MIN</code>, <code>SUM</code>,
1559+
* and <code>SAMPLECOUNT</code> statistics for each metric that is streamed. You can use the
1560+
* <code>StatisticsConfigurations</code> parameter to have
1561+
* the metric stream also send extended statistics in the stream. Streaming extended statistics incurs
1562+
* additional costs. For more information, see <a href="https://aws.amazon.com/cloudwatch/pricing/">Amazon CloudWatch Pricing</a>. </p>
1563+
*
15391564
* <p>When you use <code>PutMetricStream</code> to create a new metric stream, the stream
15401565
* is created in the <code>running</code> state. If you use it to update an existing stream,
15411566
* the state of the stream is not changed.</p>

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

+21-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,21 @@ export interface GetMetricDataCommandInput extends GetMetricDataInput {}
2222
export interface GetMetricDataCommandOutput extends GetMetricDataOutput, __MetadataBearer {}
2323

2424
/**
25-
* <p>You can use the <code>GetMetricData</code> API to retrieve as many as 500 different
25+
* <p>You can use the <code>GetMetricData</code> API to retrieve CloudWatch metric values. The operation
26+
* can also include a CloudWatch Metrics Insights query, and one or more metric math functions.</p>
27+
* <p>A <code>GetMetricData</code> operation that does not include a query can retrieve as many as 500 different
2628
* metrics in a single request, with a total of as many as 100,800 data points. You can also
27-
* optionally perform math expressions on the values of the returned statistics, to create
29+
* optionally perform metric math expressions on the values of the returned statistics, to create
2830
* new time series that represent new insights into your data. For example, using Lambda
2931
* metrics, you could divide the Errors metric by the Invocations metric to get an error
3032
* rate time series. For more information about metric math expressions, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax">Metric Math Syntax and Functions</a> in the <i>Amazon CloudWatch User
31-
* Guide</i>.</p>
33+
* Guide</i>.</p>
34+
*
35+
*
36+
* <p>If you include a Metrics Insights query, each <code>GetMetricData</code> operation can include only one
37+
* query. But the same <code>GetMetricData</code> operation can also retrieve other metrics. Metrics Insights queries
38+
* can query only the most recent three hours of metric data. For more information about Metrics Insights,
39+
* see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/query_with_cloudwatch-metrics-insights.html">Query your metrics with CloudWatch Metrics Insights</a>.</p>
3240
*
3341
* <p>Calls to the <code>GetMetricData</code> API have a different pricing structure than
3442
* calls to <code>GetMetricStatistics</code>. For more information about pricing, see
@@ -58,6 +66,16 @@ export interface GetMetricDataCommandOutput extends GetMetricDataOutput, __Metad
5866
* <p>If you omit <code>Unit</code> in your request, all data that was collected with any unit is returned, along with the corresponding units that were specified
5967
* when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified.
6068
* If you specify a unit that does not match the data collected, the results of the operation are null. CloudWatch does not perform unit conversions.</p>
69+
*
70+
* <p>
71+
* <b>Using Metrics Insights queries with metric math</b>
72+
* </p>
73+
* <p>You can't mix a Metric Insights query and metric math syntax in the same expression, but
74+
* you can reference results from a Metrics Insights query within other Metric math expressions. A Metrics Insights
75+
* query without a <b>GROUP BY</b> clause returns a single time-series (TS),
76+
* and can be used as input for a metric math expression that expects a single time series. A Metrics Insights
77+
* query with a <b>GROUP BY</b> clause returns an array of time-series (TS[]),
78+
* and can be used as input for a metric math expression that expects an array of time series. </p>
6179
* @example
6280
* Use a bare-bones client and the command you need to make an API call.
6381
* ```javascript

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export interface PutCompositeAlarmCommandOutput extends __MetadataBearer {}
2727
* states of other alarms that you have created. The composite alarm goes into ALARM state
2828
* only if all conditions of the rule are met.</p>
2929
* <p>The alarms specified in a composite alarm's rule expression can include metric alarms
30-
* and other composite alarms.</p>
30+
* and other composite alarms. The rule expression of a composite alarm can include as many as 100 underlying alarms.
31+
* Any single alarm can be included in the rule expressions of as many as 150 composite alarms.</p>
3132
* <p>Using composite alarms can reduce
3233
* alarm noise. You can create multiple metric alarms,
3334
* and also create a composite alarm and

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

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ export interface PutMetricStreamCommandOutput extends PutMetricStreamOutput, __M
4747
* </li>
4848
* </ul>
4949
*
50+
* <p>By default, a metric stream always sends the <code>MAX</code>, <code>MIN</code>, <code>SUM</code>,
51+
* and <code>SAMPLECOUNT</code> statistics for each metric that is streamed. You can use the
52+
* <code>StatisticsConfigurations</code> parameter to have
53+
* the metric stream also send extended statistics in the stream. Streaming extended statistics incurs
54+
* additional costs. For more information, see <a href="https://aws.amazon.com/cloudwatch/pricing/">Amazon CloudWatch Pricing</a>. </p>
55+
*
5056
* <p>When you use <code>PutMetricStream</code> to create a new metric stream, the stream
5157
* is created in the <code>running</code> state. If you use it to update an existing stream,
5258
* the state of the stream is not changed.</p>

0 commit comments

Comments
 (0)