Skip to content

Commit

Permalink
Prometheus scaler: omit serverAddress from generated metric name (#…
Browse files Browse the repository at this point in the history
…2099)

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
  • Loading branch information
zroubalik authored Oct 13, 2021
1 parent 3998b7a commit 6dd9173
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
- API path has been changed: `github.com/kedacore/keda/v2/api/v1alpha1` -> `github.com/kedacore/keda/v2/apis/keda/v1alpha1`
- Use Patch to set FallbackCondition on ScaledObject.Status ([#2037](https://github.com/kedacore/keda/pull/2037))
- Bump Golang to 1.16.9 ([#2065](https://github.com/kedacore/keda/pull/2065)|[#2186](https://github.com/kedacore/keda/pull/2186))
- Add Makefile mockgen targets ([#2090](https://github.com/kedacore/keda/issues/2090))
- Prometheus scaler: omit `serverAddress` from generated metric name ([#2099](https://github.com/kedacore/keda/pull/2099))
- Add Makefile mockgen targets ([#2090](https://github.com/kedacore/keda/issues/2090)|[#2184](https://github.com/kedacore/keda/pull/2184))

## v2.4.0
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/prometheus_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (s *prometheusScaler) GetMetricSpecForScaling() []v2beta2.MetricSpec {
targetMetricValue := resource.NewQuantity(int64(s.metadata.threshold), resource.DecimalSI)
externalMetric := &v2beta2.ExternalMetricSource{
Metric: v2beta2.MetricIdentifier{
Name: kedautil.NormalizeString(fmt.Sprintf("%s-%s-%s", "prometheus", s.metadata.serverAddress, s.metadata.metricName)),
Name: kedautil.NormalizeString(fmt.Sprintf("%s-%s", "prometheus", s.metadata.metricName)),
},
Target: v2beta2.MetricTarget{
Type: v2beta2.AverageValueMetricType,
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/prometheus_scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var testPromMetadata = []parsePrometheusMetadataTestData{
}

var prometheusMetricIdentifiers = []prometheusMetricIdentifier{
{&testPromMetadata[1], "prometheus-http---localhost-9090-http_requests_total"},
{&testPromMetadata[1], "prometheus-http_requests_total"},
}

type prometheusAuthMetadataTestData struct {
Expand Down

0 comments on commit 6dd9173

Please sign in to comment.