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

Calculate cpu and mem savings in tortoise #427

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

randytqwjp
Copy link
Collaborator

What this PR does / why we need it:

Calculates CPU and MEM savings based on min/max replica changes.

Which issue(s) this PR fixes:

#411

Fixes #

Special notes for your reviewer:

@randytqwjp randytqwjp requested a review from sanposhiho as a code owner January 8, 2025 14:23

NetCPURequest = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "net_cpu_request",
Help: "net cpu request (millicore) that tortoises actually applys",
}, []string{"tortoise_name", "namespace", "container_name", "controller_name", "controller_kind"})
}, []string{"tortoise_name", "namespace", "container_name", "kube_deployment", "controller_kind"})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we have to change it? I do prefer controller_name, which allows us to support other kind of resources (replicaset etc) in the future, and is also consistent with GKE metrics.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm but which controller is it referring to? because in the code it is actually referring to the deployment name. i just thought controller_name was a little confusing. But as you mentioned about the breaking change then we could leave it as is because theres no specific need to change it

Copy link
Collaborator

@sanposhiho sanposhiho Jan 10, 2025

Choose a reason for hiding this comment

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

Yeah, I remember initially I wanted to use owner_name, but I changed it to controller_name on the second thought, because controller_name is used at GKE metrics. Generally speaking, it's much easier to use the same label names as other metrics as much as possible for when you make a dashboard etc at datadog. (you can aggregate with the common labels)

Copy link
Collaborator

Choose a reason for hiding this comment

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

So, make a complaint to GKE 😅

Help: "net hpa maxReplicas that tortoises actually applys to hpa",
}, []string{"tortoise_name", "namespace", "hpa_name", "kube_deployment"})
NetHPAMinReplicasCPUCores = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "net_hpa_minreplicas_cpu_cores",
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does "net" mean?

Copy link
Collaborator

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

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

Also, you must be careful about the fact that changing metrics is a breaking change that we must avoid.
If you think you might have to change the metrics in the future, make sure you mention that in the metric description (i.e. Help), like Help: "..... This metric is the alpha stage and can be breaking-changed in the future releases."

Especially since you released v1 recently, we need to be careful about the breaking change, in general.

@randytqwjp
Copy link
Collaborator Author

Also, you must be careful about the fact that changing metrics is a breaking change that we must avoid. If you think you might have to change the metrics in the future, make sure you mention that in the metric description (i.e. Help), like Help: "..... This metric is the alpha stage and can be breaking-changed in the future releases."

Especially since you released v1 recently, we need to be careful about the breaking change, in general.

i did not know this. I will make the changes

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.

2 participants