Skip to content

Commit

Permalink
feat(client-cloudwatch): Adding support for Metrics Insights Alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
awstools committed Dec 14, 2022
1 parent 89e0a6f commit 4aa9511
Show file tree
Hide file tree
Showing 30 changed files with 582 additions and 648 deletions.
2 changes: 0 additions & 2 deletions clients/client-cloudwatch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ AWS SDK for JavaScript CloudWatch Client for Node.js, Browser and React Native.
applications you run on Amazon Web Services in real time. You can use CloudWatch to collect and track
metrics, which are the variables you want to measure for your resources and
applications.</p>

<p>CloudWatch alarms send notifications or automatically change the resources you are monitoring based on rules
that you define. For example, you can monitor the CPU usage and disk reads and writes of your Amazon EC2
instances. Then, use this data to determine whether you should launch
additional instances to handle increased load. You can also use this data to stop
under-used instances to save
money.</p>

<p>In addition to monitoring the built-in metrics that come with Amazon Web Services, you can monitor
your own custom metrics. With CloudWatch, you gain system-wide visibility into resource
utilization, application performance, and operational health.</p>
Expand Down
260 changes: 112 additions & 148 deletions clients/client-cloudwatch/src/CloudWatch.ts

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions clients/client-cloudwatch/src/CloudWatchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,13 @@ export interface CloudWatchClientResolvedConfig extends CloudWatchClientResolved
* applications you run on Amazon Web Services in real time. You can use CloudWatch to collect and track
* metrics, which are the variables you want to measure for your resources and
* applications.</p>
*
* <p>CloudWatch alarms send notifications or automatically change the resources you are monitoring based on rules
* <p>CloudWatch alarms send notifications or automatically change the resources you are monitoring based on rules
* that you define. For example, you can monitor the CPU usage and disk reads and writes of your Amazon EC2
* instances. Then, use this data to determine whether you should launch
* additional instances to handle increased load. You can also use this data to stop
* under-used instances to save
* money.</p>
*
* <p>In addition to monitoring the built-in metrics that come with Amazon Web Services, you can monitor
* <p>In addition to monitoring the built-in metrics that come with Amazon Web Services, you can monitor
* your own custom metrics. With CloudWatch, you gain system-wide visibility into resource
* utilization, application performance, and operational health.</p>
*/
Expand Down
8 changes: 4 additions & 4 deletions clients/client-cloudwatch/src/commands/DeleteAlarmsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ export interface DeleteAlarmsCommandOutput extends __MetadataBearer {}
* <p>Deletes the specified alarms. You can delete up to 100 alarms in one operation. However, this total can include no more
* than one composite alarm. For example, you could delete 99 metric alarms and one composite alarms with one operation, but you can't
* delete two composite alarms with one operation.</p>
* <p>
* <p>
* In the event of an error, no alarms are
* deleted.</p>
* <note>
* <note>
* <p>It is possible to create a loop or cycle of composite alarms, where composite alarm A depends on composite alarm B, and
* composite alarm B also depends on composite alarm A. In this scenario, you can't delete any composite alarm that is part of the cycle
* because there is always still a composite alarm that depends on that alarm that you want to delete.</p>
* <p>To get out of such a situation, you must
* <p>To get out of such a situation, you must
* break the cycle by changing the rule of one of the composite alarms in the cycle to remove a dependency that creates the cycle. The simplest
* change to make to break a cycle is to change the <code>AlarmRule</code> of one of the alarms to <code>false</code>. </p>
* <p>Additionally, the evaluation of composite alarms stops if CloudWatch detects a cycle in the evaluation path.
* <p>Additionally, the evaluation of composite alarms stops if CloudWatch detects a cycle in the evaluation path.
* </p>
* </note>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface DeleteInsightRulesCommandOutput extends DeleteInsightRulesOutpu

/**
* <p>Permanently deletes the specified Contributor Insights rules.</p>
* <p>If you create a rule, delete it, and then re-create it with the same name, historical data from the first time
* <p>If you create a rule, delete it, and then re-create it with the same name, historical data from the first time
* the rule was created might
* not be available.</p>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export interface DescribeAlarmHistoryCommandOutput extends DescribeAlarmHistoryO
/**
* <p>Retrieves the history for the specified alarm. You can filter the results by date range or item type.
* If an alarm name is not specified, the histories for either all metric alarms or all composite alarms are returned.</p>
* <p>CloudWatch retains the history of an alarm even if you delete the alarm.</p>
* <p>To use this operation and return information about a composite alarm, you must be signed on with
* <p>CloudWatch retains the history of an alarm even if you delete the alarm.</p>
* <p>To use this operation and return information about a composite alarm, you must be signed on with
* the <code>cloudwatch:DescribeAlarmHistory</code> permission that is scoped to <code>*</code>. You can't return information
* about composite alarms if your <code>cloudwatch:DescribeAlarmHistory</code> permission has a narrower scope.</p>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface DescribeAlarmsCommandOutput extends DescribeAlarmsOutput, __Met
/**
* <p>Retrieves the specified alarms. You can filter the results by specifying a prefix for the alarm
* name, the alarm state, or a prefix for any action.</p>
* <p>To use this operation and return information about composite alarms, you must be signed on with
* <p>To use this operation and return information about composite alarms, you must be signed on with
* the <code>cloudwatch:DescribeAlarms</code> permission that is scoped to <code>*</code>. You can't return information
* about composite alarms if your <code>cloudwatch:DescribeAlarms</code> permission has a narrower scope.</p>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface DescribeAlarmsForMetricCommandOutput extends DescribeAlarmsForM
/**
* <p>Retrieves the alarms for the specified metric. To
* filter the results, specify a statistic, period, or unit.</p>
* <p>This operation retrieves only standard alarms that are based on
* <p>This operation retrieves only standard alarms that are based on
* the specified metric. It does not return alarms based on math expressions that
* use the specified metric, or composite alarms that use the specified metric.</p>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export interface DescribeInsightRulesCommandOutput extends DescribeInsightRulesO

/**
* <p>Returns a list of all the Contributor Insights rules in your account.</p>
*
* <p>For more information about Contributor Insights, see
* <p>For more information about Contributor Insights, see
* <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights.html">Using Contributor Insights to Analyze High-Cardinality Data</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface GetDashboardCommandOutput extends GetDashboardOutput, __Metadat

/**
* <p>Displays the details of the dashboard that you specify.</p>
* <p>To copy an existing dashboard, use <code>GetDashboard</code>, and then use the data returned
* <p>To copy an existing dashboard, use <code>GetDashboard</code>, and then use the data returned
* within <code>DashboardBody</code> as the template for the new dashboard when you call <code>PutDashboard</code> to create
* the copy.</p>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,40 @@ export interface GetInsightRuleReportCommandOutput extends GetInsightRuleReportO
/**
* <p>This operation returns the time series data collected by a Contributor Insights rule. The data includes the identity and number of
* contributors to the log group.</p>
* <p>You can also optionally return one or more statistics about each data point in the time series. These statistics can include the following:</p>
* <ul>
* <p>You can also optionally return one or more statistics about each data point in the time series. These statistics can include the following:</p>
* <ul>
* <li>
* <p>
* <p>
* <code>UniqueContributors</code> -- the number of unique contributors for each data point.</p>
* </li>
* </li>
* <li>
* <p>
* <p>
* <code>MaxContributorValue</code> -- the value of the top contributor for each data point. The identity of the
* contributor might change for each data point in the graph.</p>
* <p>If this rule aggregates by COUNT, the top contributor for each data point is the contributor with the
* <p>If this rule aggregates by COUNT, the top contributor for each data point is the contributor with the
* most occurrences in that period. If the rule aggregates by SUM, the top contributor is the contributor with the highest sum in the log field specified
* by the rule's <code>Value</code>, during that period.</p>
* </li>
* </li>
* <li>
* <p>
* <p>
* <code>SampleCount</code> -- the number of data points matched by the rule.</p>
* </li>
* </li>
* <li>
* <p>
* <p>
* <code>Sum</code> -- the sum of the values from all contributors during the time period represented by that data point.</p>
* </li>
* </li>
* <li>
* <p>
* <p>
* <code>Minimum</code> -- the minimum value from a single observation during the time period represented by that data point.</p>
* </li>
* </li>
* <li>
* <p>
* <p>
* <code>Maximum</code> -- the maximum value from a single observation during the time period represented by that data point.</p>
* </li>
* </li>
* <li>
* <p>
* <p>
* <code>Average</code> -- the average value from all contributors during the time period represented by that data point.</p>
* </li>
* </li>
* </ul>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
24 changes: 9 additions & 15 deletions clients/client-cloudwatch/src/commands/GetMetricDataCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,22 @@ export interface GetMetricDataCommandOutput extends GetMetricDataOutput, __Metad
/**
* <p>You can use the <code>GetMetricData</code> API to retrieve CloudWatch metric values. The operation
* can also include a CloudWatch Metrics Insights query, and one or more metric math functions.</p>
* <p>A <code>GetMetricData</code> operation that does not include a query can retrieve as many as 500 different
* <p>A <code>GetMetricData</code> operation that does not include a query can retrieve as many as 500 different
* metrics in a single request, with a total of as many as 100,800 data points. You can also
* optionally perform metric math expressions on the values of the returned statistics, to create
* new time series that represent new insights into your data. For example, using Lambda
* metrics, you could divide the Errors metric by the Invocations metric to get an error
* 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
* Guide</i>.</p>
*
*
* <p>If you include a Metrics Insights query, each <code>GetMetricData</code> operation can include only one
* <p>If you include a Metrics Insights query, each <code>GetMetricData</code> operation can include only one
* query. But the same <code>GetMetricData</code> operation can also retrieve other metrics. Metrics Insights queries
* can query only the most recent three hours of metric data. For more information about Metrics Insights,
* 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>
*
* <p>Calls to the <code>GetMetricData</code> API have a different pricing structure than
* <p>Calls to the <code>GetMetricData</code> API have a different pricing structure than
* calls to <code>GetMetricStatistics</code>. For more information about pricing, see
* <a href="https://aws.amazon.com/cloudwatch/pricing/">Amazon CloudWatch Pricing</a>.</p>
*
* <p>Amazon CloudWatch retains metric data as follows:</p>
* <ul>
* <p>Amazon CloudWatch retains metric data as follows:</p>
* <ul>
* <li>
* <p>Data points with a period of less than 60 seconds are available for 3 hours. These data points are high-resolution
* metrics and are available only for custom metrics that have been defined with a <code>StorageResolution</code> of 1.</p>
Expand All @@ -65,19 +61,17 @@ export interface GetMetricDataCommandOutput extends GetMetricDataOutput, __Metad
* <p>Data points with a period of 3600 seconds (1 hour) are available for 455 days (15 months).</p>
* </li>
* </ul>
* <p>Data points that are initially published with a shorter period are aggregated together for long-term storage. For example, if you collect
* <p>Data points that are initially published with a shorter period are aggregated together for long-term storage. For example, if you collect
* data using a period of 1 minute, the data remains available for 15 days with 1-minute resolution. After 15 days, this data is still available,
* but is aggregated and retrievable only with a resolution of 5 minutes. After 63 days, the data is further aggregated and is available with
* a resolution of 1 hour.</p>
*
* <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
* <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
* when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified.
* 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>
*
* <p>
* <p>
* <b>Using Metrics Insights queries with metric math</b>
* </p>
* <p>You can't mix a Metric Insights query and metric math syntax in the same expression, but
* <p>You can't mix a Metric Insights query and metric math syntax in the same expression, but
* you can reference results from a Metrics Insights query within other Metric math expressions. A Metrics Insights
* query without a <b>GROUP BY</b> clause returns a single time-series (TS),
* and can be used as input for a metric math expression that expects a single time series. A Metrics Insights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,30 @@ export interface GetMetricStatisticsCommandOutput extends GetMetricStatisticsOut

/**
* <p>Gets statistics for the specified metric.</p>
*
*
*
* <p>The maximum number of data points returned from a single call is 1,440. If
* <p>The maximum number of data points returned from a single call is 1,440. If
* you request more than 1,440 data points, CloudWatch returns an error.
* To reduce the number of data points, you can narrow the specified time range and make
* multiple requests across adjacent time ranges, or you can increase the specified period.
* Data points are not returned in chronological order.</p>
*
* <p>CloudWatch aggregates data points based on the length of the period
* <p>CloudWatch aggregates data points based on the length of the period
* that you specify. For example, if you request statistics with a one-hour period,
* CloudWatch aggregates all data points with time stamps that fall within each
* one-hour period. Therefore, the number of values aggregated by CloudWatch is larger than
* the number of data points returned.</p>
* <p>CloudWatch needs raw data points to calculate percentile statistics. If you publish
* <p>CloudWatch needs raw data points to calculate percentile statistics. If you publish
* data using a statistic set instead, you can only retrieve
* percentile statistics for this data if one of the following conditions is true:</p>
* <ul>
* <ul>
* <li>
* <p>The SampleCount value of the statistic set is 1.</p>
* </li>
* <li>
* <p>The Min and the Max values of the statistic set are equal.</p>
* </li>
* </ul>
* <p>Percentile statistics are not available for metrics when any of the metric values are negative numbers.</p>
* <p>Amazon CloudWatch retains metric data as follows:</p>
* <ul>
* <p>Percentile statistics are not available for metrics when any of the metric values are negative numbers.</p>
* <p>Amazon CloudWatch retains metric data as follows:</p>
* <ul>
* <li>
* <p>Data points with a period of less than 60 seconds are available for 3 hours. These data points are high-resolution
* metrics and are available only for custom metrics that have been defined with a <code>StorageResolution</code> of 1.</p>
Expand All @@ -72,13 +68,12 @@ export interface GetMetricStatisticsCommandOutput extends GetMetricStatisticsOut
* <p>Data points with a period of 3600 seconds (1 hour) are available for 455 days (15 months).</p>
* </li>
* </ul>
* <p>Data points that are initially published with a shorter period are aggregated together for long-term storage. For example, if you collect
* <p>Data points that are initially published with a shorter period are aggregated together for long-term storage. For example, if you collect
* data using a period of 1 minute, the data remains available for 15 days with 1-minute resolution. After 15 days, this data is still available,
* but is aggregated and retrievable only with a resolution of 5 minutes. After 63 days, the data is further aggregated and is available with
* a resolution of 1 hour.</p>
* <p>CloudWatch started retaining 5-minute and 1-hour metric data as of July 9, 2016.</p>
*
* <p>For information about metrics and dimensions supported by Amazon Web Services services, see the
* <p>CloudWatch started retaining 5-minute and 1-hour metric data as of July 9, 2016.</p>
* <p>For information about metrics and dimensions supported by Amazon Web Services services, see the
* <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html">Amazon CloudWatch Metrics and Dimensions Reference</a> in the
* <i>Amazon CloudWatch User Guide</i>.</p>
* @example
Expand Down
Loading

0 comments on commit 4aa9511

Please sign in to comment.