Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions pkg/job/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,87 @@ func Test_getFilteredMetricDatas(t *testing.T) {
},
},
},
{
"sagemaker endpoint with variant",
args{
region: "us-east-1",
accountID: "123123123123",
namespace: "sagemaker",
customTags: nil,
tagsOnMetrics: []string{
"Value1",
"Value2",
},
dimensionRegexps: config.SupportedServices.
GetService("AWS/SageMaker").
ToModelDimensionsRegexp(),
// We don't set dimensionNameRequirements here: we want to allow
// metrics that have extra dimensions like VariantName.
resources: []*model.TaggedResource{
{
ARN: "arn:aws:sagemaker:us-east-1:123123123123:endpoint/someendpoint",
Tags: []model.Tag{
{
Key: "Environment",
Value: "prod",
},
},
Namespace: "sagemaker",
Region: "us-east-1",
},
},
metricsList: []*model.Metric{
{
MetricName: "ModelLatency",
Namespace: "AWS/SageMaker",
Dimensions: []model.Dimension{
// Note the mixed case here – this is what your
// SageMaker fixDimension logic is about.
{Name: "EndpointName", Value: "SomeEndpoint"},
{Name: "VariantName", Value: "AllTraffic"},
},
},
},
m: &model.MetricConfig{
Name: "ModelLatency",
Statistics: []string{
"Average",
},
Period: 60,
Length: 600,
Delay: 120,
NilToZero: false,
AddCloudwatchTimestamp: false,
},
},
[]model.CloudwatchData{
{
MetricName: "ModelLatency",
Dimensions: []model.Dimension{
// getFilteredMetricDatas just forwards cwMetric.Dimensions,
// so we expect both EndpointName AND VariantName here.
{Name: "EndpointName", Value: "SomeEndpoint"},
{Name: "VariantName", Value: "AllTraffic"},
},
ResourceName: "arn:aws:sagemaker:us-east-1:123123123123:endpoint/someendpoint",
Namespace: "sagemaker",
Tags: []model.Tag{
{Key: "Value1", Value: ""},
{Key: "Value2", Value: ""},
},
GetMetricDataProcessingParams: &model.GetMetricDataProcessingParams{
Statistic: "Average",
Period: 60,
Length: 600,
Delay: 120,
},
MetricMigrationParams: model.MetricMigrationParams{
NilToZero: false,
AddCloudwatchTimestamp: false,
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
18 changes: 18 additions & 0 deletions pkg/job/maxdimassociator/associator_sagemaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,24 @@ func TestAssociatorSagemaker(t *testing.T) {
expectedSkip: false,
expectedResource: sagemakerInferenceComponentInvocationUpper,
},
{
name: "variant name match in Upper case",
args: args{
dimensionRegexps: config.SupportedServices.GetService("AWS/SageMaker").ToModelDimensionsRegexp(),
resources: sagemakerInvocationResources,
metric: &model.Metric{
MetricName: "ModelLatency",
Namespace: "AWS/SageMaker",
Dimensions: []model.Dimension{
{Name: "EndpointName", Value: "example-endpoint-two"},
// this is the important part: VariantName with upper/mixed case
{Name: "VariantName", Value: "Variant-One"},
},
},
},
expectedSkip: false,
expectedResource: sagemakerEndpointInvocationTwo,
},
}

for _, tc := range testcases {
Expand Down