Skip to content

Commit d7f9664

Browse files
committed
Remove HTTP collector check on identifier label
This commit removes the logic that checks for an identifier label in the http collector config. It also removes the documentation on the README that mentions that the metric has to be in an old format, removed in the #219. Fixes #331 Signed-off-by: Jonathan Juares Beber <[email protected]>
1 parent 85f6dda commit d7f9664

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,8 @@ spec:
650650
type: AverageValue
651651
```
652652

653-
The HTTP collector similar to the Pod Metrics collector. The metric name should always be `http`.
654-
This value is also used in the annotations to configure the metrics adapter to query the required
655-
target. The following configuration values are supported:
653+
The HTTP collector similar to the Pod Metrics collector. The following
654+
configuration values are supported:
656655

657656
- `json-key` to specify the JSON path of the metric to be queried
658657
- `endpoint` the fully formed path to query for the metric. In the above example a Kubernetes _Service_

pkg/collector/http_collector.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const (
1818
HTTPMetricNameLegacy = "http"
1919
HTTPEndpointAnnotationKey = "endpoint"
2020
HTTPJsonPathAnnotationKey = "json-key"
21-
identifierLabel = "identifier"
2221
)
2322

2423
type HTTPCollectorPlugin struct{}
@@ -53,9 +52,6 @@ func (p *HTTPCollectorPlugin) NewCollector(hpa *v2beta2.HorizontalPodAutoscaler,
5352
if config.Metric.Selector == nil || config.Metric.Selector.MatchLabels == nil {
5453
return nil, fmt.Errorf("no label selector specified for metric: %s", config.Metric.Name)
5554
}
56-
if _, ok := config.Metric.Selector.MatchLabels[identifierLabel]; !ok {
57-
return nil, fmt.Errorf("%s is not specified as a label for metric %s", identifierLabel, config.Metric.Name)
58-
}
5955
collector.metric = config.Metric
6056
var aggFunc httpmetrics.AggregatorFunc
6157

pkg/collector/http_collector_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func makeTestHTTPCollectorConfig(endpoint, aggregator string) *MetricConfig {
8585
Metric: v2beta2.MetricIdentifier{
8686
Name: "test-metric",
8787
Selector: &v1.LabelSelector{
88-
MatchLabels: map[string]string{identifierLabel: "test-metric"},
88+
MatchLabels: map[string]string{"type": HTTPJSONPathType},
8989
},
9090
},
9191
},

0 commit comments

Comments
 (0)