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

How to get the api/v1/nodes/<NodeName>/proxy/stats/summary programatically #716

Closed
yashbhutwala opened this issue Nov 24, 2019 · 3 comments

Comments

@yashbhutwala
Copy link

No description provided.

@yashbhutwala
Copy link
Author

Figured it out, in case, anyone's wondering, had to construct the request using SubResource and Suffix and then parse it into struct; see code here

request := clientset.CoreV1().RESTClient().Get().Resource("nodes").Name(node.Name).SubResource("proxy").Suffix("stats/summary")
responseRawArrayOfBytes, err := request.DoRaw()
if err != nil {
	return nil, errors.Wrap(err, "failed to get stats from node")
}

@invidian
Copy link
Member

With newer versions of client-go, context is needed for DoRaw(), so it would actually be:

request := clientset.CoreV1().RESTClient().Get().Resource("nodes").Name(node.Name).SubResource("proxy").Suffix("stats/summary")
responseRawArrayOfBytes, err := request.DoRaw(context.Background())
if err != nil {
	return nil, errors.Wrap(err, "failed to get stats from node")
}

@vlerenc
Copy link

vlerenc commented Oct 5, 2024

@yashbhutwala @invidian Do you know, whether there is also a bulk call to get these metrics for all nodes in one go?

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

No branches or pull requests

3 participants