diff --git a/client.go b/client.go index 8897aa8..c456c7b 100644 --- a/client.go +++ b/client.go @@ -47,18 +47,13 @@ func NewClient(cfg *Config) (*Client, error) { } client := gpb.NewGreptimeDatabaseClient(conn) - return &Client{cfg: cfg, client: client}, nil -} - -// NewHealthCheckClient helps to create the health check client, which will be responsible checking GreptimeDB health status. -func NewHealthCheckClient(cfg *Config) (*Client, error) { - conn, err := grpc.Dial(cfg.endpoint(), cfg.build()...) - if err != nil { - return nil, err - } + healthCheckClient := gpb.NewHealthCheckClient(conn) - client := gpb.NewHealthCheckClient(conn) - return &Client{cfg: cfg, healthCheckClient: client}, nil + return &Client{ + cfg: cfg, + client: client, + healthCheckClient: healthCheckClient, + }, nil } // submit is to build request and send it to GreptimeDB. diff --git a/examples/healthcheck/main.go b/examples/healthcheck/main.go index 525d671..d99e3b3 100644 --- a/examples/healthcheck/main.go +++ b/examples/healthcheck/main.go @@ -28,7 +28,7 @@ var ( func init() { cfg := greptime.NewConfig("127.0.0.1").WithDatabase("public") - cli_, err := greptime.NewHealthCheckClient(cfg) + cli_, err := greptime.NewClient(cfg) if err != nil { log.Panic(err) }