class Stats
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudWatch.Stats |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#Stats |
Java | software.amazon.awscdk.services.cloudwatch.Stats |
Python | aws_cdk.aws_cloudwatch.Stats |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch » Stats |
Factory functions for standard statistics strings.
Example
declare const dashboard: cloudwatch.Dashboard;
declare const executionCountMetric: cloudwatch.Metric;
declare const errorCountMetric: cloudwatch.Metric;
dashboard.addWidgets(new cloudwatch.GraphWidget({
title: "Executions vs error rate",
left: [executionCountMetric],
right: [errorCountMetric.with({
statistic: cloudwatch.Stats.AVERAGE,
label: "Error rate",
color: cloudwatch.Color.GREEN,
})]
}));
Initializer
new Stats()
Properties
Name | Type | Description |
---|---|---|
static AVERAGE | string | The value of Sum / SampleCount during the specified period. |
static IQM | string | Interquartile mean (IQM) is the trimmed mean of the interquartile range, or the middle 50% of values. |
static MAXIMUM | string | The highest value observed during the specified period. |
static MINIMUM | string | The lowest value observed during the specified period. |
static SAMPLE_COUNT | string | The count (number) of data points used for the statistical calculation. |
static SUM | string | All values submitted for the matching metric added together. |
static AVERAGE
Type:
string
The value of Sum / SampleCount during the specified period.
static IQM
Type:
string
Interquartile mean (IQM) is the trimmed mean of the interquartile range, or the middle 50% of values.
It is equivalent to trimmedMean(25, 75)
.
static MAXIMUM
Type:
string
The highest value observed during the specified period.
You can use this value to determine high volumes of activity for your application.
static MINIMUM
Type:
string
The lowest value observed during the specified period.
You can use this value to determine low volumes of activity for your application.
static SAMPLE_COUNT
Type:
string
The count (number) of data points used for the statistical calculation.
static SUM
Type:
string
All values submitted for the matching metric added together.
This statistic can be useful for determining the total volume of a metric.
Methods
Name | Description |
---|---|
static p(percentile) | A shorter alias for percentile() . |
static percentile(percentile) | Percentile indicates the relative standing of a value in a dataset. |
static percentile | Percentile rank (PR) is the percentage of values that meet a fixed threshold. |
static pr(v1, v2?) | Shorter alias for percentileRank() . |
static tc(p1, p2?) | Shorter alias for trimmedCount() . |
static tm(p1, p2?) | A shorter alias for trimmedMean() . |
static trimmed | Trimmed count (TC) is the number of data points in the chosen range for a trimmed mean statistic. |
static trimmed | Trimmed mean (TM) is the mean of all values that are between two specified boundaries. |
static trimmed | Trimmed sum (TS) is the sum of the values of data points in a chosen range for a trimmed mean statistic. |
static ts(p1, p2?) | Shorter alias for trimmedSum() . |
static winsorized | Winsorized mean (WM) is similar to trimmed mean. |
static wm(p1, p2?) | A shorter alias for winsorizedMean() . |
static p(percentile)
public static p(percentile: number): string
Parameters
- percentile
number
Returns
string
A shorter alias for percentile()
.
static percentile(percentile)
public static percentile(percentile: number): string
Parameters
- percentile
number
Returns
string
Percentile indicates the relative standing of a value in a dataset.
Percentiles help you get a better understanding of the distribution of your metric data.
For example, p(90)
is the 90th percentile and means that 90% of the data
within the period is lower than this value and 10% of the data is higher
than this value.
Rank(v1, v2?)
static percentilepublic static percentileRank(v1: number, v2?: number): string
Parameters
- v1
number
- v2
number
Returns
string
Percentile rank (PR) is the percentage of values that meet a fixed threshold.
- If two numbers are given, they define the lower and upper bounds in absolute values, respectively.
- If one number is given, it defines the upper bound (the lower bound is assumed to be 0).
For example, percentileRank(300)
returns the percentage of data points that have a value of 300 or less.
percentileRank(100, 2000)
returns the percentage of data points that have a value between 100 and 2000.
static pr(v1, v2?)
public static pr(v1: number, v2?: number): string
Parameters
- v1
number
- v2
number
Returns
string
Shorter alias for percentileRank()
.
static tc(p1, p2?)
public static tc(p1: number, p2?: number): string
Parameters
- p1
number
- p2
number
Returns
string
Shorter alias for trimmedCount()
.
static tm(p1, p2?)
public static tm(p1: number, p2?: number): string
Parameters
- p1
number
- p2
number
Returns
string
A shorter alias for trimmedMean()
.
Count(p1, p2?)
static trimmedpublic static trimmedCount(p1: number, p2?: number): string
Parameters
- p1
number
- p2
number
Returns
string
Trimmed count (TC) is the number of data points in the chosen range for a trimmed mean statistic.
- If two numbers are given, they define the lower and upper bounds in percentages, respectively.
- If one number is given, it defines the upper bound (the lower bound is assumed to be 0).
For example, tc(90)
returns the number of data points not including any
data points that fall in the highest 10% of the values. tc(10, 90)
returns the number of data points not including any data points that fall
in the lowest 10% of the values and the highest 90% of the values.
Mean(p1, p2?)
static trimmedpublic static trimmedMean(p1: number, p2?: number): string
Parameters
- p1
number
- p2
number
Returns
string
Trimmed mean (TM) is the mean of all values that are between two specified boundaries.
Values outside of the boundaries are ignored when the mean is calculated. You define the boundaries as one or two numbers between 0 and 100, up to 10 decimal places. The numbers are percentages.
- If two numbers are given, they define the lower and upper bounds in percentages, respectively.
- If one number is given, it defines the upper bound (the lower bound is assumed to be 0).
For example, tm(90)
calculates the average after removing the 10% of data
points with the highest values; tm(10, 90)
calculates the average after removing the
10% with the lowest and 10% with the highest values.
Sum(p1, p2?)
static trimmedpublic static trimmedSum(p1: number, p2?: number): string
Parameters
- p1
number
- p2
number
Returns
string
Trimmed sum (TS) is the sum of the values of data points in a chosen range for a trimmed mean statistic.
It is equivalent to (Trimmed Mean) * (Trimmed count)
.
- If two numbers are given, they define the lower and upper bounds in percentages, respectively.
- If one number is given, it defines the upper bound (the lower bound is assumed to be 0).
For example, ts(90)
returns the sum of the data points not including any
data points that fall in the highest 10% of the values. ts(10, 90)
returns the sum of the data points not including any data points that fall
in the lowest 10% of the values and the highest 90% of the values.
static ts(p1, p2?)
public static ts(p1: number, p2?: number): string
Parameters
- p1
number
- p2
number
Returns
string
Shorter alias for trimmedSum()
.
Mean(p1, p2?)
static winsorizedpublic static winsorizedMean(p1: number, p2?: number): string
Parameters
- p1
number
- p2
number
Returns
string
Winsorized mean (WM) is similar to trimmed mean.
However, with winsorized mean, the values that are outside the boundary are not ignored, but instead are considered to be equal to the value at the edge of the appropriate boundary. After this normalization, the average is calculated. You define the boundaries as one or two numbers between 0 and 100, up to 10 decimal places.
- If two numbers are given, they define the lower and upper bounds in percentages, respectively.
- If one number is given, it defines the upper bound (the lower bound is assumed to be 0).
For example, tm(90)
calculates the average after removing the 10% of data
points with the highest values; tm(10, 90)
calculates the average after removing the
10% with the lowest and 10% with the highest values.
For example, wm(90)
calculates the average while treating the 10% of the
highest values to be equal to the value at the 90th percentile.
wm(10, 90)
calculates the average while treaing the bottom 10% and the
top 10% of values to be equal to the boundary values.
static wm(p1, p2?)
public static wm(p1: number, p2?: number): string
Parameters
- p1
number
- p2
number
Returns
string
A shorter alias for winsorizedMean()
.