Change hostname collector type to requests-per-second

Signed-off-by: Lucas Thiesen <lucas.thiesen@zalando.de>
This commit is contained in:
Lucas Thiesen
2023-05-03 20:54:08 +02:00
parent 153d754353
commit 2f5d3f5a42
2 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@ import (
) )
const ( const (
HostnameMetricType = "hostname-rps" HostnameMetricType = "requests-per-second"
HostnameRPSQuery = `scalar(sum(rate(%s{host=~"%s"}[1m])) * %.4f)` HostnameRPSQuery = `scalar(sum(rate(%s{host=~"%s"}[1m])) * %.4f)`
) )

View File

@ -189,8 +189,8 @@ func TestHostnameCollectorAndCollectorFabricInteraction(t *testing.T) {
hpa := &autoscalingv2.HorizontalPodAutoscaler{ hpa := &autoscalingv2.HorizontalPodAutoscaler{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
"metric-config.external.foo.hostname-rps/hostnames": "just.testing.com", "metric-config.external.foo.requests-per-second/hostnames": "just.testing.com",
"metric-config.external.foo.hostname-rps/weight": "42", "metric-config.external.foo.requests-per-second/weight": "42",
}, },
}, },
Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ Spec: autoscalingv2.HorizontalPodAutoscalerSpec{
@ -201,7 +201,7 @@ func TestHostnameCollectorAndCollectorFabricInteraction(t *testing.T) {
Metric: autoscalingv2.MetricIdentifier{ Metric: autoscalingv2.MetricIdentifier{
Name: "foo", Name: "foo",
Selector: &metav1.LabelSelector{ Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"type": "hostname-rps"}, MatchLabels: map[string]string{"type": "requests-per-second"},
}, },
}, },
}, },
@ -234,9 +234,9 @@ func TestHostnamePrometheusCollectorInteraction(t *testing.T) {
hpa := &autoscalingv2.HorizontalPodAutoscaler{ hpa := &autoscalingv2.HorizontalPodAutoscaler{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
"metric-config.external.foo.hostname-rps/hostnames": "just.testing.com", "metric-config.external.foo.requests-per-second/hostnames": "just.testing.com",
"metric-config.external.foo.hostname-rps/weight": "42", "metric-config.external.foo.requests-per-second/weight": "42",
"metric-config.external.bar.prometheus/query": promQuery, "metric-config.external.bar.prometheus/query": promQuery,
}, },
}, },
Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ Spec: autoscalingv2.HorizontalPodAutoscalerSpec{
@ -247,7 +247,7 @@ func TestHostnamePrometheusCollectorInteraction(t *testing.T) {
Metric: autoscalingv2.MetricIdentifier{ Metric: autoscalingv2.MetricIdentifier{
Name: "foo", Name: "foo",
Selector: &metav1.LabelSelector{ Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"type": "hostname-rps"}, MatchLabels: map[string]string{"type": "requests-per-second"},
}, },
}, },
}, },