mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2025-05-12 08:21:54 +00:00
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 <jonathanbeber@gmail.com>
This commit is contained in:
@ -650,9 +650,8 @@ spec:
|
|||||||
type: AverageValue
|
type: AverageValue
|
||||||
```
|
```
|
||||||
|
|
||||||
The HTTP collector similar to the Pod Metrics collector. The metric name should always be `http`.
|
The HTTP collector similar to the Pod Metrics collector. The following
|
||||||
This value is also used in the annotations to configure the metrics adapter to query the required
|
configuration values are supported:
|
||||||
target. The following configuration values are supported:
|
|
||||||
|
|
||||||
- `json-key` to specify the JSON path of the metric to be queried
|
- `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_
|
- `endpoint` the fully formed path to query for the metric. In the above example a Kubernetes _Service_
|
||||||
|
@ -18,7 +18,6 @@ const (
|
|||||||
HTTPMetricNameLegacy = "http"
|
HTTPMetricNameLegacy = "http"
|
||||||
HTTPEndpointAnnotationKey = "endpoint"
|
HTTPEndpointAnnotationKey = "endpoint"
|
||||||
HTTPJsonPathAnnotationKey = "json-key"
|
HTTPJsonPathAnnotationKey = "json-key"
|
||||||
identifierLabel = "identifier"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type HTTPCollectorPlugin struct{}
|
type HTTPCollectorPlugin struct{}
|
||||||
@ -53,9 +52,6 @@ func (p *HTTPCollectorPlugin) NewCollector(hpa *v2beta2.HorizontalPodAutoscaler,
|
|||||||
if config.Metric.Selector == nil || config.Metric.Selector.MatchLabels == nil {
|
if config.Metric.Selector == nil || config.Metric.Selector.MatchLabels == nil {
|
||||||
return nil, fmt.Errorf("no label selector specified for metric: %s", config.Metric.Name)
|
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
|
collector.metric = config.Metric
|
||||||
var aggFunc httpmetrics.AggregatorFunc
|
var aggFunc httpmetrics.AggregatorFunc
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ func makeTestHTTPCollectorConfig(endpoint, aggregator string) *MetricConfig {
|
|||||||
Metric: v2beta2.MetricIdentifier{
|
Metric: v2beta2.MetricIdentifier{
|
||||||
Name: "test-metric",
|
Name: "test-metric",
|
||||||
Selector: &v1.LabelSelector{
|
Selector: &v1.LabelSelector{
|
||||||
MatchLabels: map[string]string{identifierLabel: "test-metric"},
|
MatchLabels: map[string]string{"type": HTTPJSONPathType},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user