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

rpk: add cpu_profile to rpk debug bundle #16414

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

r-vasquez
Copy link
Contributor

@r-vasquez r-vasquez commented Feb 1, 2024

This PR adds the raw response of the CPU profile admin endpoint to the bundle generated by rpk debug bundle.

It introduces a new flag: --cpu-profiler-wait with a default of 30s, which sets the internal wait_ms of the Admin API's GET /v1/debug/cpu_profile

File Location: bundle/admin/cpu_profile_<node_address>.json

Fixes #13175

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x
  • v23.1.x

Release Notes

Features

  • rpk debug bundle now includes a CPU profile of the requested nodes.

To modify defaults in our Admin API client.

This can be easily expanded to support modifying:
- MaxRetries
- Backooff Function
- LogHook Function.
In the future.
@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Feb 1, 2024

new failures in https://buildkite.com/redpanda/redpanda/builds/44564#018d6267-ca50-4e98-99b2-64d5cf4d229e:

"rptest.tests.rpk_cluster_test.RpkClusterTest.test_debug_bundle"

new failures in https://buildkite.com/redpanda/redpanda/builds/44564#018d6279-eb74-47e3-bc2f-f9daf6de91eb:

"rptest.tests.rpk_cluster_test.RpkClusterTest.test_debug_bundle"

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Feb 1, 2024

gene-redpanda
gene-redpanda previously approved these changes Feb 1, 2024
@@ -186,3 +193,10 @@ func (a *AdminAPI) DebugPartition(ctx context.Context, namespace, topic string,
var response DebugPartition
return response, a.sendAny(ctx, http.MethodGet, fmt.Sprintf("/v1/debug/partition/%v/%v/%v", namespace, topic, partitionID), nil, &response)
}

// RawCPUProfile returns the raw response of the CPU profiler.
func (a *AdminAPI) RawCPUProfile(ctx context.Context, wait time.Duration) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for this PR
Maybe if we do Raw a lot, we can just introduce a

func (*AdminAPI) RawRequest(ctx context.Context, pathfmt string, pathargs ...interface{})

or some other similar API

This commit add the CPU profile to every
debug bundle with a default 30ms of wait
sample.
@r-vasquez r-vasquez merged commit 72b7011 into redpanda-data:dev Feb 2, 2024
24 checks passed
@mattschumpert
Copy link

@r-vasquez we should update the diag bundle docs to show this in the payload. Thnx

@r-vasquez r-vasquez deleted the rpk_cpu_profiler_2 branch April 12, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add /v1/debug/cpu_profile to rpk debug bundle
5 participants