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 native resource metrics in proxy #2481

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

ikaven1024
Copy link
Member

@ikaven1024 ikaven1024 commented Sep 7, 2022

Signed-off-by: yingjinhui yingjinhui@didiglobal.com

What type of PR is this?
/kind feature

What this PR does / why we need it:
When accessing resources via proxy, metrics only records proxying, can't see real resources:

apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="0.05"} 0
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="0.1"} 0
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="0.2"} 3
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="0.4"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="0.6"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="0.8"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="1"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="1.25"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="1.5"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="2"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="3"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="4"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="5"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="6"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="8"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="10"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="15"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="20"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="30"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="45"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="60"} 5
apiserver_request_duration_seconds_bucket{component="apiserver",dry_run="",group="search.karmada.io",resource="proxying",scope="resource",subresource="",verb="GET",version="v1alpha1",le="+Inf"} 5

This PR will record the real resources:

apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="0.05"} 0
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="0.1"} 0
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="0.2"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="0.4"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="0.6"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="0.8"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="1"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="1.25"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="1.5"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="2"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="3"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="4"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="5"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="6"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="8"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="10"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="15"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="20"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="30"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="45"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="60"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="nodes",scope="",subresource="",verb="GET",version="v1",le="+Inf"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="0.05"} 0
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="0.1"} 0
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="0.2"} 3
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="0.4"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="0.6"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="0.8"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="1"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="1.25"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="1.5"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="2"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="3"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="4"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="5"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="6"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="8"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="10"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="15"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="20"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="30"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="45"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="60"} 4
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="",resource="pods",scope="",subresource="",verb="GET",version="v1",le="+Inf"} 4

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

karmada-search: users can get the real resource request metrics while using proxy.

Signed-off-by: yingjinhui <yingjinhui@didiglobal.com>
@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 7, 2022
@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 7, 2022
@ikaven1024
Copy link
Member Author

/assign @XiShanYongYe-Chang

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

Generally looks good to me, ask @Poor12 to take a look.

@XiShanYongYe-Chang
Copy link
Member

Hi @ikaven1024, can you help update the release note, thanks~

@Poor12
Copy link
Member

Poor12 commented Sep 9, 2022

A little question, from the before and after changes in metrics, I found that metrics ignores the group "search.karmada.io", is this a consideration?

@ikaven1024
Copy link
Member Author

A little question, from the before and after changes in metrics, I found that metrics ignores the group "search.karmada.io", is this a consideration?

This is actually the group name of request resource. In this example, the group of pods and nodes is just "".
When request deployment and cluster, records:

apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="apps",resource="deployments",scope="",subresource="",verb="GET",version="v1",le="0.05"} 1
apiserver_request_duration_seconds_bucket{component="karmada-search",dry_run="",group="cluster.karmada.io",resource="clusters",scope="",subresource="",verb="GET",version="v1alpha1",le="0.05"} 1

@Poor12
Copy link
Member

Poor12 commented Sep 9, 2022

Thanks for explaination. Generally look good to me.

@XiShanYongYe-Chang
Copy link
Member

Thanks for @Poor12 .

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 9, 2022
@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 Sep 9, 2022
@karmada-bot karmada-bot merged commit abc0f7c into karmada-io:master Sep 9, 2022
@ikaven1024 ikaven1024 deleted the pr-metrics branch September 9, 2022 08:10
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants