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

add metrics for recreate/update resource event when sync work status #5247

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

chaosi-zju
Copy link
Member

@chaosi-zju chaosi-zju commented Jul 25, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

add metrics for recreate/update resource event when sync work status

detail backgroud:

When I create a sa and a sa type secret in control plane, yet, I only propagate the secret to member clusters, then the secret will be deleted immediately by sa-controller of the member cluster. In turn the work_status_controller will watch the deletion event and recreate the resource to cluster, this cycle goes on and never stops.

Normally, there shouldn't be a large number of recreate events, so, I want to record a metric of the recreate event which can monitor the abnormal situation.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Test report:

# HELP recreate_resource_to_cluster Number of recreating operation of the resource to a target member cluster. By the result, 'error' means a resource recreated failed. Otherwise 'success'. Cluster means the target member cluster.
# TYPE recreate_resource_to_cluster counter
recreate_resource_to_cluster{apigroup="v1",cluster="member1",kind="Secret",result="success"} 810
recreate_resource_to_cluster{apigroup="v1",cluster="member2",kind="Secret",result="success"} 809
# HELP update_resource_to_cluster Number of updating operation of the resource to a target member cluster. By the result, 'error' means a resource updated failed. Otherwise 'success'. Cluster means the target member cluster.
# TYPE update_resource_to_cluster counter
update_resource_to_cluster{apigroup="rbac.authorization.k8s.io/v1",cluster="member1",kind="ClusterRole",result="success"} 2
update_resource_to_cluster{apigroup="rbac.authorization.k8s.io/v1",cluster="member2",kind="ClusterRole",result="success"} 1

Does this PR introduce a user-facing change?:

karmada-controller-manager: add metrics for recreate/update resource event when sync work status

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 25, 2024
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 25, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 25, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Project coverage is 28.26%. Comparing base (bc1c96e) to head (32850c4).
Report is 10 commits behind head on master.

Files Patch % Lines
pkg/controllers/status/work_status_controller.go 0.00% 6 Missing ⚠️
pkg/metrics/resource.go 0.00% 6 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5247      +/-   ##
==========================================
- Coverage   28.26%   28.26%   -0.01%     
==========================================
  Files         632      632              
  Lines       43732    43741       +9     
==========================================
+ Hits        12360    12362       +2     
- Misses      30470    30479       +9     
+ Partials      902      900       -2     
Flag Coverage Δ
unittests 28.26% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@XiShanYongYe-Chang
Copy link
Member

XiShanYongYe-Chang commented Jul 25, 2024

Hi @chaunceyjiang @whitewindmills would you like to have a look?
/cc @chaunceyjiang @whitewindmills

@XiShanYongYe-Chang
Copy link
Member

How about updating the release note like this:

karmada-controller-manager/karmada-agent: add metrics for recreate/update resource event when sync work status

pkg/metrics/resource.go Outdated Show resolved Hide resolved
pkg/metrics/resource.go Outdated Show resolved Hide resolved
pkg/metrics/resource.go Outdated Show resolved Hide resolved
@chaosi-zju chaosi-zju force-pushed the metrics branch 5 times, most recently from 53a5221 to 6d85a4b Compare July 25, 2024 13:10
@XiShanYongYe-Chang
Copy link
Member

Thanks~
/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2024
@karmada-bot karmada-bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2024
@chaosi-zju
Copy link
Member Author

/retest

@chaosi-zju
Copy link
Member Author

hi @whitewindmills, do you have any further comments?

@whitewindmills
Copy link
Member

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2024
@XiShanYongYe-Chang
Copy link
Member

/approve

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 26, 2024
@karmada-bot karmada-bot merged commit c38f169 into karmada-io:master Jul 26, 2024
12 checks passed
@XiShanYongYe-Chang
Copy link
Member

Can you help add those new metrics in the website?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants