From 363b2714cac3832ce4c75d979dbd0e2dfc9ed63e Mon Sep 17 00:00:00 2001 From: Lucas Thiesen Date: Wed, 3 May 2023 20:54:08 +0200 Subject: [PATCH] Change hostname collector type to requests-per-second Signed-off-by: Lucas Thiesen --- pkg/collector/hostname_collector.go | 2 +- pkg/collector/hostname_collector_test.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/collector/hostname_collector.go b/pkg/collector/hostname_collector.go index ab4b1823..b2d5937f 100644 --- a/pkg/collector/hostname_collector.go +++ b/pkg/collector/hostname_collector.go @@ -11,7 +11,7 @@ import ( ) const ( - HostnameMetricType = "hostname-rps" + HostnameMetricType = "requests-per-second" HostnameRPSQuery = `scalar(sum(rate(%s{host=~"%s"}[1m])) * %.4f)` ) diff --git a/pkg/collector/hostname_collector_test.go b/pkg/collector/hostname_collector_test.go index 6f7bf7be..06e76141 100644 --- a/pkg/collector/hostname_collector_test.go +++ b/pkg/collector/hostname_collector_test.go @@ -189,8 +189,8 @@ func TestHostnameCollectorAndCollectorFabricInteraction(t *testing.T) { hpa := &autoscalingv2.HorizontalPodAutoscaler{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ - "metric-config.external.foo.hostname-rps/hostnames": "just.testing.com", - "metric-config.external.foo.hostname-rps/weight": "42", + "metric-config.external.foo.requests-per-second/hostnames": "just.testing.com", + "metric-config.external.foo.requests-per-second/weight": "42", }, }, Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ @@ -201,7 +201,7 @@ func TestHostnameCollectorAndCollectorFabricInteraction(t *testing.T) { Metric: autoscalingv2.MetricIdentifier{ Name: "foo", 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{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ - "metric-config.external.foo.hostname-rps/hostnames": "just.testing.com", - "metric-config.external.foo.hostname-rps/weight": "42", - "metric-config.external.bar.prometheus/query": promQuery, + "metric-config.external.foo.requests-per-second/hostnames": "just.testing.com", + "metric-config.external.foo.requests-per-second/weight": "42", + "metric-config.external.bar.prometheus/query": promQuery, }, }, Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ @@ -247,7 +247,7 @@ func TestHostnamePrometheusCollectorInteraction(t *testing.T) { Metric: autoscalingv2.MetricIdentifier{ Name: "foo", Selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{"type": "hostname-rps"}, + MatchLabels: map[string]string{"type": "requests-per-second"}, }, }, },