Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Improve metric name creation to be unique using scaler index #2155

Closed
wants to merge 2 commits into from

Conversation

JorTurFer
Copy link
Member

Signed-off-by: jorturfer [email protected]

This draft shows the approach of using the scaler index as a prefix to ensure all metric names are unique in the ScaledObject. All the metric names will be composed using the pattern sX-currentMetricName where x is the index.

I have just tried the changes executing PostgreSQL and MongoDB e2e tests and it works really fine.
I tried to do above the scalers in order to avoid a lot of changes.
@tomkerkhove @zroubalik @ahmelsayed
Could you share your thoughts?

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO - learn more)
  • Tests have been added
  • A PR is opened to update our Helm chart (repo) (if applicable, ie. when deployment manifests are modified)
  • A PR is opened to update the documentation on (repo) (if applicable)
  • Changelog has been updated

Fixes #2123

for _, metricSpec := range metricSpecs {
if metricSpec.Resource != nil {
resourceMetricNames = append(resourceMetricNames, string(metricSpec.Resource.Name))
}

if metricSpec.External != nil {
// Add the scaler index prefix
metricSpec.External.Metric.Name = fmt.Sprintf("s%d-%s", scalerIndex, metricSpec.External.Metric.Name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that we are adding the prefix here, imho scaler.GetMetricSpecForScaling() should return the final metric name.

@JorTurFer JorTurFer closed this Oct 5, 2021
@JorTurFer JorTurFer deleted the unique_names_index branch November 5, 2021 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve metric name creation to be unique
2 participants