Skip to content

Commit

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

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
Signed-off-by: nilayasiktoprak <nilayasiktoprak@gmail.com>
  • Loading branch information
zroubalik authored and nilayasiktoprak committed Oct 23, 2021
1 parent a15e44b commit 24e3e62
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 24e3e62

Please sign in to comment.