Skip to content

Commit

Permalink
Merge pull request #332 from zalando-incubator/drop-identifier
Browse files Browse the repository at this point in the history
Remove HTTP collector check on identifier label
  • Loading branch information
jonathanbeber authored Jun 1, 2021
2 parents 85f6dda + d7f9664 commit 9da1555
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,8 @@ spec:
type: AverageValue
```

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

- `json-key` to specify the JSON path of the metric to be queried
- `endpoint` the fully formed path to query for the metric. In the above example a Kubernetes _Service_
Expand Down
4 changes: 0 additions & 4 deletions pkg/collector/http_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const (
HTTPMetricNameLegacy = "http"
HTTPEndpointAnnotationKey = "endpoint"
HTTPJsonPathAnnotationKey = "json-key"
identifierLabel = "identifier"
)

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/collector/http_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func makeTestHTTPCollectorConfig(endpoint, aggregator string) *MetricConfig {
Metric: v2beta2.MetricIdentifier{
Name: "test-metric",
Selector: &v1.LabelSelector{
MatchLabels: map[string]string{identifierLabel: "test-metric"},
MatchLabels: map[string]string{"type": HTTPJSONPathType},
},
},
},
Expand Down

0 comments on commit 9da1555

Please sign in to comment.