Skip to content

Commit

Permalink
Use '-rps' prefix in RPS metric name
Browse files Browse the repository at this point in the history
  • Loading branch information
lucastt committed Jun 29, 2023
1 parent 6d7e963 commit ee3772c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pkg/core/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,14 @@ func externalRPSMetric(metrics zv1.AutoscalerMetrics, stackname string, weight f
return nil, nil, fmt.Errorf("RequestsPerSecond.hostnames value not specified for metric")
}

name := stackname + "-rps"

average := metrics.Average.DeepCopy()
generated := &autoscaling.MetricSpec{
Type: autoscaling.ExternalMetricSourceType,
External: &autoscaling.ExternalMetricSource{
Metric: autoscaling.MetricIdentifier{
Name: stackname,
Name: name,
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"type": "requests-per-second"},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/core/autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func TestStackSetController_ReconcileAutoscalersScalingSchedule(t *testing.T) {
}

func TestStackSetController_ReconcileAutoscalersExternalRPS(t *testing.T) {
name := "stackset-v1"
name := "stackset-v1-rps"
validateHpa := func(tt *testing.T, expectedHosts string, weight float64, average int32, ssc StackContainer) {
hpa, err := ssc.GenerateHPA()
require.NoError(tt, err, "failed to create an HPA")
Expand Down Expand Up @@ -408,7 +408,7 @@ func TestCPUMetricValid(t *testing.T) {
}

func TestExternalRPSMetricInvalid(t *testing.T) {
name := "stackset-v1"
name := "stackset-v1-rps"
for _, tc := range []struct {
desc string
m zv1.AutoscalerMetrics
Expand Down

0 comments on commit ee3772c

Please sign in to comment.