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

observe metrics in recommendation controller #693

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

whitebear009
Copy link
Contributor

What type of PR is this?

optimize

What this PR does / why we need it:

Currutly recommendation metrics will lost after restart craned because the metrics is created in the progress of calculation of recommend.
If we observe recommendation status in recommedation controller, that can avoid this issue.

Which issue(s) this PR fixes:

Fixes #672

Special notes for your reviewer:

@github-actions
Copy link
Contributor

github-actions bot commented Feb 14, 2023

🎉 Successfully Build Images.
Now Support ARM Platforms.
Comment Post Time: 2023-02-20 15:11
Git Version: 30b4d6b

Docker Registry

Overview: https://hub.docker.com/u/gocrane

Image Pull Command
crane-agent:pr-693-30b4d6b docker pull gocrane/crane-agent:pr-693-30b4d6b
dashboard:pr-693-30b4d6b docker pull gocrane/dashboard:pr-693-30b4d6b
metric-adapter:pr-693-30b4d6b docker pull gocrane/metric-adapter:pr-693-30b4d6b
craned:pr-693-30b4d6b docker pull gocrane/craned:pr-693-30b4d6b

Quick Deploy - Helm

helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
                   --set craned.image.repository=gocrane/craned \
                   --set craned.image.tag=pr-693-30b4d6b \
                   --set metricAdapter.image.repository=gocrane/metric-adapter \
                   --set metricAdapter.image.tag=pr-693-30b4d6b \
                   --set craneAgent.image.repository=gocrane/crane-agent \
                   --set craneAgent.image.tag=pr-693-30b4d6b \
                   --set cranedDashboard.image.repository=gocrane/dashboard \
                   --set cranedDashboard.image.tag=pr-693-30b4d6b crane/crane

Coding Registry

Overview: https://finops.coding.net/public-artifacts/gocrane/crane/packages

Image Pull Command
crane-agent:pr-693-30b4d6b docker pull finops-docker.pkg.coding.net/gocrane/crane/crane-agent:pr-693-30b4d6b
dashboard:pr-693-30b4d6b docker pull finops-docker.pkg.coding.net/gocrane/crane/dashboard:pr-693-30b4d6b
metric-adapter:pr-693-30b4d6b docker pull finops-docker.pkg.coding.net/gocrane/crane/metric-adapter:pr-693-30b4d6b
craned:pr-693-30b4d6b docker pull finops-docker.pkg.coding.net/gocrane/crane/craned:pr-693-30b4d6b

Quick Deploy - Helm

helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
                   --set craned.image.repository=finops-docker.pkg.coding.net/gocrane/crane/craned \
                   --set craned.image.tag=pr-693-30b4d6b \
                   --set metricAdapter.image.repository=finops-docker.pkg.coding.net/gocrane/crane/metric-adapter \
                   --set metricAdapter.image.tag=pr-693-30b4d6b \
                   --set craneAgent.image.repository=finops-docker.pkg.coding.net/gocrane/crane/crane-agent \
                   --set craneAgent.image.tag=pr-693-30b4d6b \
                   --set cranedDashboard.image.repository=finops-docker.pkg.coding.net/gocrane/crane/dashboard \
                   --set cranedDashboard.image.tag=pr-693-30b4d6b crane/crane

Ghcr Registry

Overview: https://github.com/orgs/gocrane/packages?repo_name=crane

Image Pull Command
crane-agent:pr-693-30b4d6b docker pull ghcr.io/gocrane/crane/crane-agent:pr-693-30b4d6b
dashboard:pr-693-30b4d6b docker pull ghcr.io/gocrane/crane/dashboard:pr-693-30b4d6b
metric-adapter:pr-693-30b4d6b docker pull ghcr.io/gocrane/crane/metric-adapter:pr-693-30b4d6b
craned:pr-693-30b4d6b docker pull ghcr.io/gocrane/crane/craned:pr-693-30b4d6b

Quick Deploy - Helm

helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
                   --set craned.image.repository=ghcr.io/gocrane/crane/craned \
                   --set craned.image.tag=pr-693-30b4d6b \
                   --set metricAdapter.image.repository=ghcr.io/gocrane/crane/metric-adapter \
                   --set metricAdapter.image.tag=pr-693-30b4d6b \
                   --set craneAgent.image.repository=ghcr.io/gocrane/crane/crane-agent \
                   --set craneAgent.image.tag=pr-693-30b4d6b \
                   --set cranedDashboard.image.repository=ghcr.io/gocrane/crane/dashboard \
                   --set cranedDashboard.image.tag=pr-693-30b4d6b crane/crane

@@ -13,7 +13,7 @@ var (
Name: "resource_recommendation",
Help: "The containers' CPU/Memory recommended value",
},
[]string{"apiversion", "owner_kind", "namespace", "owner_name", "container", "resource", "owner_replicas"},
Copy link

Choose a reason for hiding this comment

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

owner_replicas
Why should we discard this label?

Copy link
Contributor Author

@whitebear009 whitebear009 Feb 14, 2023

Choose a reason for hiding this comment

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

Because I thought owner_replicas is not a value that resource recommend needs to care about, there is also no related value in recommendation CRD.

Another reason is that I refactor thses code with a common method (the input parameter of the observe function was changed from RecommendationContext to Recommendation). If this field needs to be displayed, it needs to be processed separately.

Please let me know if there is a need to keep this field or any other information I am missing.

Copy link
Member

Choose a reason for hiding this comment

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

replicas * resource = total workload resource now
so i think it is useful here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will adjust it later

@whitebear009 whitebear009 force-pushed the recommendation-metrics branch 2 times, most recently from 093db6c to b1311ee Compare February 20, 2023 05:28
@whitebear009
Copy link
Contributor Author

@qmhu Already updated, PTAL

@qmhu
Copy link
Member

qmhu commented Feb 20, 2023

@qmhu Already updated, PTAL

Please fix the lint

@whitebear009
Copy link
Contributor Author

Sorry, miss that. It is fixed now.

@qmhu qmhu merged commit 6ee7b4e into gocrane:main Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

recommendation metrics lost after restart craned
3 participants