diff --git a/client/http/interface.go b/client/http/interface.go index 76fe133f1ac9..ca14b3ae40fe 100644 --- a/client/http/interface.go +++ b/client/http/interface.go @@ -338,6 +338,7 @@ func (c *client) SetStoreLabels(ctx context.Context, storeID int64, storeLabels WithBody(jsonInput)) } +// GetHealthStatus gets the health status of the cluster. func (c *client) GetHealthStatus(ctx context.Context) ([]Health, error) { var healths []Health err := c.request(ctx, newRequestInfo(). diff --git a/tools/pd-ctl/pdctl/command/health_command.go b/tools/pd-ctl/pdctl/command/health_command.go index 96a0e9069c21..9ffe5bb539a7 100644 --- a/tools/pd-ctl/pdctl/command/health_command.go +++ b/tools/pd-ctl/pdctl/command/health_command.go @@ -32,7 +32,7 @@ func NewHealthCommand() *cobra.Command { } func showHealthCommandFunc(cmd *cobra.Command, _ []string) { - health, err := PDCli.GetHealthStatus(context.Background()) + health, err := PDCli.GetHealthStatus(cmd.Context()) if err != nil { cmd.Println(err) return