Skip to content

Commit

Permalink
Merge pull request #151 from nodeset-org/remove-stats
Browse files Browse the repository at this point in the history
Deprecate `service stats`
  • Loading branch information
jclapis authored Sep 27, 2024
2 parents a13d26b + 3f323f4 commit 7d99e7f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 33 deletions.
17 changes: 0 additions & 17 deletions hyperdrive-cli/client/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,23 +262,6 @@ func (c *HyperdriveClient) PrintDaemonLogs(composeFiles []string, tail string, l
return printOutput(cmd)
}

// Print the Hyperdrive service stats
func (c *HyperdriveClient) PrintServiceStats(composeFiles []string) error {
// Get service container IDs
cmd, err := c.compose(composeFiles, "ps -q")
if err != nil {
return err
}
containers, err := readOutput(cmd)
if err != nil {
return err
}
containerIds := strings.Split(strings.TrimSpace(string(containers)), "\n")

// Print stats
return printOutput(fmt.Sprintf("docker stats %s", strings.Join(containerIds, " ")))
}

// Print the Hyperdrive service compose config
func (c *HyperdriveClient) PrintServiceCompose(composeFiles []string) error {
cmd, err := c.compose(composeFiles, "config")
Expand Down
7 changes: 2 additions & 5 deletions hyperdrive-cli/commands/service/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,10 @@ func RegisterCommands(app *cli.App, name string, aliases []string) {
{
Name: "stats",
Aliases: []string{"a"},
Usage: "View the Hyperdrive service stats",
Usage: "DEPRECATED - No longer supported",
Action: func(c *cli.Context) error {
// Validate args
utils.ValidateArgCount(c, 0)

// Run command
return serviceStats(c)
return serviceStats()
},
},

Expand Down
15 changes: 4 additions & 11 deletions hyperdrive-cli/commands/service/stats.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package service

import (
"github.com/nodeset-org/hyperdrive/hyperdrive-cli/client"
"github.com/urfave/cli/v2"
"fmt"
)

// View the Hyperdrive service stats
func serviceStats(c *cli.Context) error {
// Get Hyperdrive client
hd, err := client.NewHyperdriveClientFromCtx(c)
if err != nil {
return err
}

// Print service stats
return hd.PrintServiceStats(getComposeFiles(c))
func serviceStats() error {
fmt.Println("No longer supported - please run `docker stats -a` instead.")
return nil
}
6 changes: 6 additions & 0 deletions install/packages/debian/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
hyperdrive (1.1.0~b2) UNRELEASED; urgency=medium

* The `service stats` command has been deprecated; for people that wanted to track container stats, we recommend just running `docker stats -a` instead.

-- NodeSet Inc. <[email protected]> Thu, 26 Sep 2024 20:23:47 +0000

hyperdrive (1.1.0~b1) unstable; urgency=medium

* Added the Constellation module. It can be accessed via the `hyperdrive cs` command.
Expand Down

0 comments on commit 7d99e7f

Please sign in to comment.