File tree 2 files changed +24
-0
lines changed
packages/aws-cdk-lib/aws-cloudwatch 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ export interface PercentileStatistic extends SingleStatistic {
34
34
statName : 'percentile' ;
35
35
}
36
36
37
+ export interface PercentileRankStatistic extends PairStatistic {
38
+ statName : 'percentileRank' ;
39
+ }
40
+
37
41
export interface TrimmedMeanStatistic extends PairStatistic {
38
42
statName : 'trimmedMean' ;
39
43
}
@@ -154,6 +158,7 @@ export function parseStatistic(
154
158
) :
155
159
| SimpleStatistic
156
160
| PercentileStatistic
161
+ | PercentileRankStatistic
157
162
| TrimmedMeanStatistic
158
163
| WinsorizedMeanStatistic
159
164
| TrimmedCountStatistic
@@ -188,6 +193,10 @@ export function parseStatistic(
188
193
m = parseSingleStatistic ( stat , 'p' ) ;
189
194
if ( m ) return { ...m , statName : 'percentile' } as PercentileStatistic ;
190
195
196
+ // Percentile Rank statistics
197
+ m = parsePairStatistic ( stat , 'pr' ) ;
198
+ if ( m ) return { ...m , statName : 'percentileRank' } as PercentileRankStatistic ;
199
+
191
200
// Trimmed mean statistics
192
201
m = parseSingleStatistic ( stat , 'tm' ) || parsePairStatistic ( stat , 'tm' ) ;
193
202
if ( m ) return { ...m , statName : 'trimmedMean' } as TrimmedMeanStatistic ;
Original file line number Diff line number Diff line change
1
+ import { Metric , Stats } from '../../aws-cloudwatch' ;
1
2
import * as cloudwatch from '../lib' ;
2
3
4
+ it . each ( [
5
+ Stats . percentileRank ( 0 ) ,
6
+ Stats . percentileRank ( 0 , 1 ) ,
7
+ Stats . percentileRank ( 0 , undefined ) ,
8
+ ] ) ( 'Stats can create valid statistics %s without causing warnings' , ( statistic ) => {
9
+ const metric = new Metric ( {
10
+ namespace : 'example' ,
11
+ metricName : 'example' ,
12
+ statistic,
13
+ } ) ;
14
+
15
+ expect ( metric . warningsV2 ) . toEqual ( undefined ) ;
16
+ } ) ;
17
+
3
18
test ( 'spot check some constants' , ( ) => {
4
19
expect ( cloudwatch . Stats . AVERAGE ) . toEqual ( 'Average' ) ;
5
20
expect ( cloudwatch . Stats . IQM ) . toEqual ( 'IQM' ) ;
You can’t perform that action at this time.
0 commit comments