mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2025-01-03 07:40:09 +00:00
Change hostname collector type to requests-per-second
Signed-off-by: Lucas Thiesen <lucas.thiesen@zalando.de>
This commit is contained in:
@ -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)`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -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"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user