Skip to content

Conversation

seshachalam-yv
Copy link

@seshachalam-yv seshachalam-yv commented Jul 4, 2025

Fixes #20275
Part of #20217

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

etcdctl sample output

✗ ./bin/etcdctl diagnosis --cluster -o diagnosis.json

cc @ahrtr

@k8s-ci-robot
Copy link

Hi @seshachalam-yv. Thanks for your PR.

I'm waiting for a etcd-io 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-sigs/prow repository.

@seshachalam-yv seshachalam-yv changed the title Etcdctl diagnosis etcdctl: Migrate etcd-diagnosis as a new subcommand diagnosis Jul 4, 2025
@seshachalam-yv
Copy link
Author

Thanks @ahrtr for your review. I’ve addressed your comments.
Apologies for the delay — I was away for an extended period due to personal reasons.

@ahrtr
Copy link
Member

ahrtr commented Sep 5, 2025

Please license header for each new go file.

// Copyright 2025 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

Also I suggest to move the directory diagnosis to etcdctl/ctlv3/command/diagnosis

@seshachalam-yv seshachalam-yv force-pushed the etcdctl-diagnosis branch 3 times, most recently from 8150f28 to 5ea93eb Compare September 12, 2025 14:33
@ahrtr
Copy link
Member

ahrtr commented Sep 13, 2025

pls signoff the commit or squash the commit (preferred)

Introduces `etcdctl diagnose` with plugin-based checks: endpoint status, membership, metrics, and read path.

Produces machine-readable JSON output.

Places engine and plugins under `etcdctl/ctlv3/command/diagnosis/...`.

Wires the subcommand into `ctlv3` CLI.

Signed-off-by: Yerasala Venkata, Seshachalam <[email protected]>
Adds README section for `diagnose` command, flags, and output.

Fixes README link to the example.

Signed-off-by: Yerasala Venkata, Seshachalam <[email protected]>
Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

LGTM with a minor comment.

Thank you!

#### Flags

- `--cluster`: use all endpoints discovered from the cluster member list.
- `--etcd-storage-quota-bytes`: expected etcd storage quota in bytes (value passed to etcd with `--quota-backend-bytes`).
Copy link
Member

Choose a reason for hiding this comment

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

For etcd version >= 3.6.0, we are able to get the quota by endpoint status query. For versions < 3.6.0, we still need to users to provide a value for this flag.

It's OK to enhance this in a followup PR.

@ahrtr
Copy link
Member

ahrtr commented Sep 18, 2025

/ok-to-test

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

Please resolve the workflow failures, thx

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: seshachalam-yv
Once this PR has been reviewed and has the lgtm label, please assign ivanvc for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link

@seshachalam-yv: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-etcd-markdown-lint 95785f0 link true /test pull-etcd-markdown-lint
pull-etcd-e2e-386 95785f0 link true /test pull-etcd-e2e-386
pull-etcd-verify 95785f0 link true /test pull-etcd-verify
pull-etcd-unit-test-386 95785f0 link true /test pull-etcd-unit-test-386

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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-sigs/prow repository. I understand the commands that are listed here.

Copy link

codecov bot commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 0% with 360 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.40%. Comparing base (0de7907) to head (95785f0).
⚠️ Report is 111 commits behind head on main.

Files with missing lines Patch % Lines
...ctlv3/command/diagnosis/plugins/epstatus/plugin.go 0.00% 93 Missing ⚠️
.../ctlv3/command/diagnosis/plugins/metrics/plugin.go 0.00% 80 Missing ⚠️
...ctl/ctlv3/command/diagnosis/plugins/read/plugin.go 0.00% 68 Missing ⚠️
...lv3/command/diagnosis/plugins/membership/plugin.go 0.00% 54 Missing ⚠️
etcdctl/ctlv3/command/diagnosis_command.go 0.00% 47 Missing ⚠️
...l/ctlv3/command/diagnosis/plugins/common/client.go 0.00% 10 Missing ⚠️
...tcdctl/ctlv3/command/diagnosis/engine/diagnosis.go 0.00% 7 Missing ⚠️
etcdctl/ctlv3/ctl.go 0.00% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
etcdctl/ctlv3/ctl.go 0.00% <0.00%> (ø)
...tcdctl/ctlv3/command/diagnosis/engine/diagnosis.go 0.00% <0.00%> (ø)
...l/ctlv3/command/diagnosis/plugins/common/client.go 0.00% <0.00%> (ø)
etcdctl/ctlv3/command/diagnosis_command.go 0.00% <0.00%> (ø)
...lv3/command/diagnosis/plugins/membership/plugin.go 0.00% <0.00%> (ø)
...ctl/ctlv3/command/diagnosis/plugins/read/plugin.go 0.00% <0.00%> (ø)
.../ctlv3/command/diagnosis/plugins/metrics/plugin.go 0.00% <0.00%> (ø)
...ctlv3/command/diagnosis/plugins/epstatus/plugin.go 0.00% <0.00%> (ø)

... and 76 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #20280      +/-   ##
==========================================
+ Coverage   66.28%   69.40%   +3.11%     
==========================================
  Files         420      411       -9     
  Lines       34776    34587     -189     
==========================================
+ Hits        23053    24005     +952     
+ Misses      10321     9190    -1131     
+ Partials     1402     1392      -10     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0de7907...95785f0. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

etcdctl: Migrate etcd-diagnosis as a new subcommand diagnosis
3 participants