diff options
Diffstat (limited to 'internal/clients/healthclient.go')
| -rw-r--r-- | internal/clients/healthclient.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/internal/clients/healthclient.go b/internal/clients/healthclient.go index f3ba81f..c614a52 100644 --- a/internal/clients/healthclient.go +++ b/internal/clients/healthclient.go @@ -7,6 +7,7 @@ import ( "github.com/mimecast/dtail/internal/clients/handlers" "github.com/mimecast/dtail/internal/config" + "github.com/mimecast/dtail/internal/io/dlog" "github.com/mimecast/dtail/internal/omode" gossh "golang.org/x/crypto/ssh" @@ -25,14 +26,18 @@ func NewHealthClient(args config.Args) (*HealthClient, error) { c := HealthClient{ baseClient: baseClient{ + mu: newBaseClientMu(), Args: args, throttleCh: make(chan struct{}, args.ConnectionsPerCPU*runtime.NumCPU()), retry: false, + runtime: newClientRuntimeBoundary(config.CurrentRuntime()), }, } c.init() - c.makeConnections(c) + if err := c.makeConnections(c); err != nil { + return nil, err + } return &c, nil } @@ -40,9 +45,20 @@ func (c HealthClient) makeHandler(server string) handlers.Handler { return handlers.NewHealthHandler(server) } +func (c HealthClient) makeSessionSpec() (SessionSpec, error) { + return NewSessionSpec(c.Args), nil +} + func (c HealthClient) makeCommands() (commands []string) { - commands = append(commands, "health") - return + sessionSpec, err := c.makeSessionSpec() + if err != nil { + dlog.Client.FatalPanic("unable to build health session spec", err) + } + commands, err = sessionSpec.Commands() + if err != nil { + dlog.Client.FatalPanic("unable to build health commands from session spec", err) + } + return commands } // Start the health client. |
