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 response metrics for RuntimeSDK hook client #7956

Conversation

MaxFedotov
Copy link
Contributor

What this PR does / why we need it:
This PR adds an additional response_total metric for RuntimeSDK hook client.

metric example:

# HELP capi_runtime_sdk_response_total Number of responses, partitioned by status and hook.
# TYPE capi_runtime_sdk_response_total counter
capi_runtime_sdk_response_total{group="hooks.runtime.cluster.x-k8s.io",hook="Discovery",status="Success",version="v1alpha1"} 3

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #7952

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 19, 2023
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 19, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @MaxFedotov. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@MaxFedotov MaxFedotov changed the title add response metrics for RuntimeSDK hook client (:sparkles:) add response metrics for RuntimeSDK hook client Jan 19, 2023
@MaxFedotov MaxFedotov changed the title (:sparkles:) add response metrics for RuntimeSDK hook client ✨ add response metrics for RuntimeSDK hook client Jan 19, 2023
@ykakarap
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 20, 2023
Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

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

Overall looks good.

/cc @chrischdi

@MaxFedotov MaxFedotov force-pushed the runtime-sdk-response-status-metrics branch 2 times, most recently from 3471630 to 4b9dbdf Compare January 20, 2023 17:10
Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

🤔 : I'm questioning if it makes sense to add non-http related information as metric to a metric we call http_requests_total.

Maybe we should in this case rename it to runtime_sdk_hook_calls_total (or something better) because its not a metric anymore relying on the plain http data.

Edit: we don't call it http_requests_total, so seems fine to me :D

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

Only nits 👍

internal/runtime/client/client.go Outdated Show resolved Hide resolved
internal/runtime/client/client.go Outdated Show resolved Hide resolved
internal/runtime/client/client.go Outdated Show resolved Hide resolved
@MaxFedotov
Copy link
Contributor Author

MaxFedotov commented Jan 23, 2023

And there is one more thing I would like to implement in this PR - to align bucket values with controller-runtime (set them according to this PR kubernetes-sigs/controller-runtime#1273). Right now the top bucket is le="0.512", so all requests slower than 0.5 sec goes to +Inf bucket.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 24, 2023
@MaxFedotov
Copy link
Contributor Author

@ykakarap @sbueringer hi! Is there anything left that I need to do in order to make it merged?

@sbueringer
Copy link
Member

Looks good to me, thank you!

/lgtm

Can you please squash the commits, then I would merge

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 3, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 707a673562875a18e890c52b81b884f467bf9624

@MaxFedotov MaxFedotov force-pushed the runtime-sdk-response-status-metrics branch from 9b89a55 to e49d4fc Compare February 3, 2023 14:45
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 3, 2023
fix linting issues

apply review notes. Add status to requests_total metric

apply review notes part 2

move response typecasting logic to metrics package

align capi runtime sdk histogram bucket values with controller-runtime
@MaxFedotov MaxFedotov force-pushed the runtime-sdk-response-status-metrics branch from e49d4fc to 60317e0 Compare February 3, 2023 14:47
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 3, 2023
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 3, 2023
@sbueringer
Copy link
Member

Thank you very much!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 3, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 4d2e1f9ca1dd2917dded987af5e5767b869acc35

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 3, 2023
@k8s-ci-robot k8s-ci-robot merged commit 490c85b into kubernetes-sigs:main Feb 3, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.4 milestone Feb 3, 2023
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Add Response metric to Runtime SDK hook client
5 participants