Skip to content

Commit 495f023

Browse files
author
awstools
committed
feat(client-lookoutmetrics): Release dimension value filtering feature to allow customers to define dimension filters for including only a subset of their dataset to be used by LookoutMetrics.
1 parent 3d46a39 commit 495f023

File tree

3 files changed

+246
-0
lines changed

3 files changed

+246
-0
lines changed

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

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,40 @@ export interface CreateAnomalyDetectorResponse {
10561056
AnomalyDetectorArn?: string;
10571057
}
10581058

1059+
export enum FilterOperation {
1060+
EQUALS = "EQUALS",
1061+
}
1062+
1063+
/**
1064+
* <p>Describes a filter for choosing a subset of dimension values. Each filter consists of the dimension that you want to include and the condition statement. The condition statement is specified in the <code>FilterOperation</code> object.</p>
1065+
*/
1066+
export interface Filter {
1067+
/**
1068+
* <p>The value that you want to include in the filter.</p>
1069+
*/
1070+
DimensionValue?: string;
1071+
1072+
/**
1073+
* <p>The condition to apply.</p>
1074+
*/
1075+
FilterOperation?: FilterOperation | string;
1076+
}
1077+
1078+
/**
1079+
* <p>Describes a list of filters for choosing a subset of dimension values. Each filter consists of the dimension and one of its values that you want to include. When multiple dimensions or values are specified, the dimensions are joined with an AND operation and the values are joined with an OR operation. </p>
1080+
*/
1081+
export interface MetricSetDimensionFilter {
1082+
/**
1083+
* <p>The dimension that you want to filter on.</p>
1084+
*/
1085+
Name?: string;
1086+
1087+
/**
1088+
* <p>The list of filters that you are applying.</p>
1089+
*/
1090+
FilterList?: Filter[];
1091+
}
1092+
10591093
/**
10601094
* <p>A calculation made by contrasting a measure and a dimension from your source data.</p>
10611095
*/
@@ -1386,6 +1420,11 @@ export interface CreateMetricSetRequest {
13861420
* <p>A list of <a href="https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html">tags</a> to apply to the dataset.</p>
13871421
*/
13881422
Tags?: Record<string, string>;
1423+
1424+
/**
1425+
* <p>A list of filters that specify which data is kept for anomaly detection.</p>
1426+
*/
1427+
DimensionFilterList?: MetricSetDimensionFilter[];
13891428
}
13901429

13911430
export interface CreateMetricSetResponse {
@@ -1621,6 +1660,11 @@ export interface DescribeMetricSetResponse {
16211660
* <p>Contains information about the dataset's source data.</p>
16221661
*/
16231662
MetricSource?: MetricSource;
1663+
1664+
/**
1665+
* <p>The dimensions and their values that were used to filter the dataset.</p>
1666+
*/
1667+
DimensionFilterList?: MetricSetDimensionFilter[];
16241668
}
16251669

16261670
/**
@@ -2394,6 +2438,14 @@ export interface UpdateMetricSetRequest {
23942438
* <p>Contains information about source data used to generate metrics.</p>
23952439
*/
23962440
MetricSource?: MetricSource;
2441+
2442+
/**
2443+
* <p>Describes a list of filters for choosing specific dimensions and specific values. Each
2444+
* filter consists of the dimension and one of its values that you want to include. When
2445+
* multiple dimensions or values are specified, the dimensions are joined with an AND operation
2446+
* and the values are joined with an OR operation.</p>
2447+
*/
2448+
DimensionFilterList?: MetricSetDimensionFilter[];
23972449
}
23982450

23992451
export interface UpdateMetricSetResponse {
@@ -2676,6 +2728,20 @@ export const CreateAnomalyDetectorResponseFilterSensitiveLog = (obj: CreateAnoma
26762728
...obj,
26772729
});
26782730

2731+
/**
2732+
* @internal
2733+
*/
2734+
export const FilterFilterSensitiveLog = (obj: Filter): any => ({
2735+
...obj,
2736+
});
2737+
2738+
/**
2739+
* @internal
2740+
*/
2741+
export const MetricSetDimensionFilterFilterSensitiveLog = (obj: MetricSetDimensionFilter): any => ({
2742+
...obj,
2743+
});
2744+
26792745
/**
26802746
* @internal
26812747
*/

clients/client-lookoutmetrics/src/protocols/Aws_restJson1.ts

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ import {
136136
DimensionValueContribution,
137137
ExecutionStatus,
138138
FileFormatDescriptor,
139+
Filter,
139140
InterMetricImpactDetails,
140141
InternalServerException,
141142
ItemizedMetricStats,
@@ -144,6 +145,7 @@ import {
144145
Metric,
145146
MetricLevelImpact,
146147
MetricSetDataQualityMetric,
148+
MetricSetDimensionFilter,
147149
MetricSetSummary,
148150
MetricSource,
149151
RDSSourceConfig,
@@ -286,6 +288,9 @@ export const serializeAws_restJson1CreateMetricSetCommand = async (
286288
let body: any;
287289
body = JSON.stringify({
288290
...(input.AnomalyDetectorArn != null && { AnomalyDetectorArn: input.AnomalyDetectorArn }),
291+
...(input.DimensionFilterList != null && {
292+
DimensionFilterList: serializeAws_restJson1MetricSetDimensionFilterList(input.DimensionFilterList, context),
293+
}),
289294
...(input.DimensionList != null && {
290295
DimensionList: serializeAws_restJson1DimensionList(input.DimensionList, context),
291296
}),
@@ -958,6 +963,9 @@ export const serializeAws_restJson1UpdateMetricSetCommand = async (
958963
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateMetricSet";
959964
let body: any;
960965
body = JSON.stringify({
966+
...(input.DimensionFilterList != null && {
967+
DimensionFilterList: serializeAws_restJson1MetricSetDimensionFilterList(input.DimensionFilterList, context),
968+
}),
961969
...(input.DimensionList != null && {
962970
DimensionList: serializeAws_restJson1DimensionList(input.DimensionList, context),
963971
}),
@@ -1626,6 +1634,12 @@ export const deserializeAws_restJson1DescribeMetricSetCommand = async (
16261634
if (data.CreationTime != null) {
16271635
contents.CreationTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.CreationTime)));
16281636
}
1637+
if (data.DimensionFilterList != null) {
1638+
contents.DimensionFilterList = deserializeAws_restJson1MetricSetDimensionFilterList(
1639+
data.DimensionFilterList,
1640+
context
1641+
);
1642+
}
16291643
if (data.DimensionList != null) {
16301644
contents.DimensionList = deserializeAws_restJson1DimensionList(data.DimensionList, context);
16311645
}
@@ -2985,6 +2999,21 @@ const serializeAws_restJson1FileFormatDescriptor = (input: FileFormatDescriptor,
29852999
};
29863000
};
29873001

3002+
const serializeAws_restJson1Filter = (input: Filter, context: __SerdeContext): any => {
3003+
return {
3004+
...(input.DimensionValue != null && { DimensionValue: input.DimensionValue }),
3005+
...(input.FilterOperation != null && { FilterOperation: input.FilterOperation }),
3006+
};
3007+
};
3008+
3009+
const serializeAws_restJson1FilterList = (input: Filter[], context: __SerdeContext): any => {
3010+
return input
3011+
.filter((e: any) => e != null)
3012+
.map((entry) => {
3013+
return serializeAws_restJson1Filter(entry, context);
3014+
});
3015+
};
3016+
29883017
const serializeAws_restJson1HeaderList = (input: string[], context: __SerdeContext): any => {
29893018
return input
29903019
.filter((e: any) => e != null)
@@ -3039,6 +3068,27 @@ const serializeAws_restJson1MetricNameList = (input: string[], context: __SerdeC
30393068
});
30403069
};
30413070

3071+
const serializeAws_restJson1MetricSetDimensionFilter = (
3072+
input: MetricSetDimensionFilter,
3073+
context: __SerdeContext
3074+
): any => {
3075+
return {
3076+
...(input.FilterList != null && { FilterList: serializeAws_restJson1FilterList(input.FilterList, context) }),
3077+
...(input.Name != null && { Name: input.Name }),
3078+
};
3079+
};
3080+
3081+
const serializeAws_restJson1MetricSetDimensionFilterList = (
3082+
input: MetricSetDimensionFilter[],
3083+
context: __SerdeContext
3084+
): any => {
3085+
return input
3086+
.filter((e: any) => e != null)
3087+
.map((entry) => {
3088+
return serializeAws_restJson1MetricSetDimensionFilter(entry, context);
3089+
});
3090+
};
3091+
30423092
const serializeAws_restJson1MetricSource = (input: MetricSource, context: __SerdeContext): any => {
30433093
return {
30443094
...(input.AppFlowConfig != null && {
@@ -3740,6 +3790,25 @@ const deserializeAws_restJson1FileFormatDescriptor = (output: any, context: __Se
37403790
} as any;
37413791
};
37423792

3793+
const deserializeAws_restJson1Filter = (output: any, context: __SerdeContext): Filter => {
3794+
return {
3795+
DimensionValue: __expectString(output.DimensionValue),
3796+
FilterOperation: __expectString(output.FilterOperation),
3797+
} as any;
3798+
};
3799+
3800+
const deserializeAws_restJson1FilterList = (output: any, context: __SerdeContext): Filter[] => {
3801+
const retVal = (output || [])
3802+
.filter((e: any) => e != null)
3803+
.map((entry: any) => {
3804+
if (entry === null) {
3805+
return null as any;
3806+
}
3807+
return deserializeAws_restJson1Filter(entry, context);
3808+
});
3809+
return retVal;
3810+
};
3811+
37433812
const deserializeAws_restJson1HeaderList = (output: any, context: __SerdeContext): string[] => {
37443813
const retVal = (output || [])
37453814
.filter((e: any) => e != null)
@@ -3922,6 +3991,31 @@ const deserializeAws_restJson1MetricSetDataQualityMetricList = (
39223991
return retVal;
39233992
};
39243993

3994+
const deserializeAws_restJson1MetricSetDimensionFilter = (
3995+
output: any,
3996+
context: __SerdeContext
3997+
): MetricSetDimensionFilter => {
3998+
return {
3999+
FilterList: output.FilterList != null ? deserializeAws_restJson1FilterList(output.FilterList, context) : undefined,
4000+
Name: __expectString(output.Name),
4001+
} as any;
4002+
};
4003+
4004+
const deserializeAws_restJson1MetricSetDimensionFilterList = (
4005+
output: any,
4006+
context: __SerdeContext
4007+
): MetricSetDimensionFilter[] => {
4008+
const retVal = (output || [])
4009+
.filter((e: any) => e != null)
4010+
.map((entry: any) => {
4011+
if (entry === null) {
4012+
return null as any;
4013+
}
4014+
return deserializeAws_restJson1MetricSetDimensionFilter(entry, context);
4015+
});
4016+
return retVal;
4017+
};
4018+
39254019
const deserializeAws_restJson1MetricSetSummary = (output: any, context: __SerdeContext): MetricSetSummary => {
39264020
return {
39274021
AnomalyDetectorArn: __expectString(output.AnomalyDetectorArn),

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

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,12 @@
14531453
"traits": {
14541454
"smithy.api#documentation": "<p>A list of <a href=\"https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html\">tags</a> to apply to the dataset.</p>"
14551455
}
1456+
},
1457+
"DimensionFilterList": {
1458+
"target": "com.amazonaws.lookoutmetrics#MetricSetDimensionFilterList",
1459+
"traits": {
1460+
"smithy.api#documentation": "<p>A list of filters that specify which data is kept for anomaly detection.</p>"
1461+
}
14561462
}
14571463
}
14581464
},
@@ -2186,6 +2192,12 @@
21862192
"traits": {
21872193
"smithy.api#documentation": "<p>Contains information about the dataset's source data.</p>"
21882194
}
2195+
},
2196+
"DimensionFilterList": {
2197+
"target": "com.amazonaws.lookoutmetrics#MetricSetDimensionFilterList",
2198+
"traits": {
2199+
"smithy.api#documentation": "<p>The dimensions and their values that were used to filter the dataset.</p>"
2200+
}
21892201
}
21902202
}
21912203
},
@@ -2625,6 +2637,48 @@
26252637
"smithy.api#documentation": "<p>Contains information about a source file's formatting.</p>"
26262638
}
26272639
},
2640+
"com.amazonaws.lookoutmetrics#Filter": {
2641+
"type": "structure",
2642+
"members": {
2643+
"DimensionValue": {
2644+
"target": "com.amazonaws.lookoutmetrics#DimensionValue",
2645+
"traits": {
2646+
"smithy.api#documentation": "<p>The value that you want to include in the filter.</p>"
2647+
}
2648+
},
2649+
"FilterOperation": {
2650+
"target": "com.amazonaws.lookoutmetrics#FilterOperation",
2651+
"traits": {
2652+
"smithy.api#documentation": "<p>The condition to apply.</p>"
2653+
}
2654+
}
2655+
},
2656+
"traits": {
2657+
"smithy.api#documentation": "<p>Describes a filter for choosing a subset of dimension values. Each filter consists of the dimension that you want to include and the condition statement. The condition statement is specified in the <code>FilterOperation</code> object.</p>"
2658+
}
2659+
},
2660+
"com.amazonaws.lookoutmetrics#FilterList": {
2661+
"type": "list",
2662+
"member": {
2663+
"target": "com.amazonaws.lookoutmetrics#Filter"
2664+
},
2665+
"traits": {
2666+
"smithy.api#length": {
2667+
"min": 1
2668+
}
2669+
}
2670+
},
2671+
"com.amazonaws.lookoutmetrics#FilterOperation": {
2672+
"type": "string",
2673+
"traits": {
2674+
"smithy.api#enum": [
2675+
{
2676+
"value": "EQUALS",
2677+
"name": "EQUALS"
2678+
}
2679+
]
2680+
}
2681+
},
26282682
"com.amazonaws.lookoutmetrics#FlowName": {
26292683
"type": "string",
26302684
"traits": {
@@ -3973,6 +4027,32 @@
39734027
"smithy.api#pattern": "\\S"
39744028
}
39754029
},
4030+
"com.amazonaws.lookoutmetrics#MetricSetDimensionFilter": {
4031+
"type": "structure",
4032+
"members": {
4033+
"Name": {
4034+
"target": "com.amazonaws.lookoutmetrics#ColumnName",
4035+
"traits": {
4036+
"smithy.api#documentation": "<p>The dimension that you want to filter on.</p>"
4037+
}
4038+
},
4039+
"FilterList": {
4040+
"target": "com.amazonaws.lookoutmetrics#FilterList",
4041+
"traits": {
4042+
"smithy.api#documentation": "<p>The list of filters that you are applying.</p>"
4043+
}
4044+
}
4045+
},
4046+
"traits": {
4047+
"smithy.api#documentation": "<p>Describes a list of filters for choosing a subset of dimension values. Each filter consists of the dimension and one of its values that you want to include. When multiple dimensions or values are specified, the dimensions are joined with an AND operation and the values are joined with an OR operation. </p>"
4048+
}
4049+
},
4050+
"com.amazonaws.lookoutmetrics#MetricSetDimensionFilterList": {
4051+
"type": "list",
4052+
"member": {
4053+
"target": "com.amazonaws.lookoutmetrics#MetricSetDimensionFilter"
4054+
}
4055+
},
39764056
"com.amazonaws.lookoutmetrics#MetricSetName": {
39774057
"type": "string",
39784058
"traits": {
@@ -5224,6 +5304,12 @@
52245304
},
52255305
"MetricSource": {
52265306
"target": "com.amazonaws.lookoutmetrics#MetricSource"
5307+
},
5308+
"DimensionFilterList": {
5309+
"target": "com.amazonaws.lookoutmetrics#MetricSetDimensionFilterList",
5310+
"traits": {
5311+
"smithy.api#documentation": "<p>Describes a list of filters for choosing specific dimensions and specific values. Each\n filter consists of the dimension and one of its values that you want to include. When\n multiple dimensions or values are specified, the dimensions are joined with an AND operation\n and the values are joined with an OR operation.</p>"
5312+
}
52275313
}
52285314
}
52295315
},

0 commit comments

Comments
 (0)