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

Use metricName value to set metric name #3182

Closed
wants to merge 6 commits into from

Conversation

vivekjainx86
Copy link

@vivekjainx86 vivekjainx86 commented Jun 16, 2022

Signed-off-by: vivekjainx86 vivekjainx86@gmail.com

It fixes the issue #3180

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 and is aligned with our changelog requirements

Fixes #3180

Relates to #

Signed-off-by: vivekjainx86 <vivekjainx86@gmail.com>
Signed-off-by: vivekjainx86 <vivekjainx86@gmail.com>
@vivekjainx86 vivekjainx86 requested a review from a team as a code owner June 16, 2022 10:22
Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

Looking good,
Only small nit inline
Could you open a PR in keda-docs repo explaining this new parameter?

Comment on lines 431 to 433
} else {
return nil, fmt.Errorf("no metricName given")
}
Copy link
Member

Choose a reason for hiding this comment

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

I'd not do this mandatory. I understand the reason to set it, but there are cases where this is not needed and we should use the default value (the current value).

Copy link
Author

Choose a reason for hiding this comment

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

Sure, will do that. Also, changes in keda-docs, you mean in this file? if not, can you please point me out?

Copy link
Member

Choose a reason for hiding this comment

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

Could you help me understand why do we need to introduce this parameter please? We are traing to get rid of it in general and rely on generating, as it is internal stuff.

Copy link
Author

Choose a reason for hiding this comment

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

In a scenario where PredictKube scaler is used in multiple ScaledObjects, there metric will be same, i.e. s0-predictkube-predictkube_metric.
The need of that parameter was to use user provided metricName value to uniquely identify the metric, similar to as used in Prometheus scaler. The current code doesn't do that.

Copy link
Member

@zroubalik zroubalik Jun 16, 2022

Choose a reason for hiding this comment

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

OK and are you talking about uniqueness from KEDA side or from PredictKube? Becase on KEDA side the uniqueness is assured by the combination of metricName and label on ScaledObject. So having the same metric name for multiple SOs is not a problem, we are distingush them by labels.

Do you face any specific issue in your setup?

Copy link
Author

Choose a reason for hiding this comment

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

I am talking about uniqueness from PredictKube.
Currently, we have multiple ScaledObjects with multiple triggers (PredictKube scaler along with Prometheus scalers).
But in future, we might have multiple PredictKube scalers in single ScaledObject, then it will be difficult to identify the metric by using its index, and it will not be readable.

Copy link
Member

Choose a reason for hiding this comment

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

And for what exactly do you need to read that? That's pure internal thing.

Copy link
Member

Choose a reason for hiding this comment

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

And it's just a name it is not a metric (value) itself.

Copy link
Author

Choose a reason for hiding this comment

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

I understand it. The thing is we are plotting the metrics graph to analyse the triggers and it's related scaling pattern. For Prometheus scalers, we can see given metricName, but for PredictKube, we cannot. You can refer to attached screenshot.

Screenshot 2022-06-16 at 6 01 28 PM

Even if you say that it's internal thing, but it is visible in Keda metric, and can be used to plot graphs.

Copy link
Member

Choose a reason for hiding this comment

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

Can you just add ScaledObject to the graph? So you can distinguish the values?

Signed-off-by: vivekjainx86 <vivekjainx86@gmail.com>
Signed-off-by: vivekjainx86 <vivekjainx86@gmail.com>
Signed-off-by: Vivek Jain <38214848+vivekjainx86@users.noreply.github.com>
@vivekjainx86
Copy link
Author

Hello @JorTurFer , can you please re-review the PR? I have made suggested changes, also created PR in keda-docs. Please let me know if anything missing.

@JorTurFer
Copy link
Member

Hello @JorTurFer , can you please re-review the PR? I have made suggested changes, also created PR in keda-docs. Please let me know if anything missing.

let's try till this is solved. TBH, I don't like so match giving this option because we changed it to make it internal and avoid user configs here

@avdhoot
Copy link

avdhoot commented Jun 20, 2022

Hello @JorTurFer , can you please re-review the PR? I have made suggested changes, also created PR in keda-docs. Please let me know if anything missing.

let's try till this is solved. TBH, I don't like so match giving this option because we changed it to make it internal and avoid user configs here

We are talking about single scale object having multiple metrics. how to distinguish between them in graph & metrics?

@zroubalik
Copy link
Member

Hello @JorTurFer , can you please re-review the PR? I have made suggested changes, also created PR in keda-docs. Please let me know if anything missing.

let's try till this is solved. TBH, I don't like so match giving this option because we changed it to make it internal and avoid user configs here

We are talking about single scale object having multiple metrics. how to distinguish between them in graph & metrics?

Each metric in ScaledObject has different name, so you can distinguish between them?

@avdhoot
Copy link

avdhoot commented Jun 21, 2022

Please let us know which metric is distinguishable & more importantly readable/informative? Giving random metric name in keda_metrics_adapter_scaler_metrics_value metric will loose it is usefulness. cc @zroubalik

Metrics without fix

keda_metrics_adapter_scaler_metrics_value{metric="s0-predictkube-predictkube_metric", namespace="keda", pod="keda-metrics-apiserver-8bf54d668-ftcqr", scaledObject="xxx-web", scaler="PredictKubeScaler", scalerIndex="0"}
keda_metrics_adapter_scaler_metrics_value{metric="s1-predictkube-predictkube_metric", namespace="keda", pod="keda-metrics-apiserver-8bf54d668-ftcqr", scaledObject="xxx-web", scaler="PredictKubeScaler", scalerIndex="1"}

Metrics with fix

keda_metrics_adapter_scaler_metrics_value{metric="s0-predictkube-web_predicted_requests_per_second_per_pod", namespace="keda", pod="keda-metrics-apiserver-69d4794db4-p7n8t", scaledObject="xxx-web", scaler="PredictKubeScaler", scalerIndex="0"}
keda_metrics_adapter_scaler_metrics_value{metric="s1-predictkube-celery_predicted_rabbitmq_queue_messages_published_rate", namespace="keda", pod="keda-metrics-apiserver-69d4794db4-p7n8t", scaledObject="xxx-web", scaler="PredictKubeScaler", scalerIndex="1"}

Signed-off-by: Vivek Jain <38214848+vivekjainx86@users.noreply.github.com>
@zroubalik
Copy link
Member

implemented in other way

@zroubalik zroubalik closed this Dec 8, 2022
@avdhoot
Copy link

avdhoot commented Dec 8, 2022

@zroubalik can you please share PR link or commit link of new implementation for reference?

@zroubalik
Copy link
Member

@avdhoot #3588

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.

PredictKube scaler ignores metricName value
4 participants