# Health check using gRPC client

**URL:** <https://discuss.dgraph.io/t/health-check-using-grpc-client/7154>\
**Category:** Dgraph\
**Created:** [June 12, 2020, 4:07am UTC](https://discuss.dgraph.io/t/health-check-using-grpc-client/7154 "2020-06-12T04:07:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![teja](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@teja](https://discuss.dgraph.io/u/teja)\
**Post date:** [June 12, 2020, 4:07am UTC](https://discuss.dgraph.io/t/health-check-using-grpc-client/7154/1 "2020-06-12T04:07:28Z")

</div>

Hi,

I am trying to establish Dgraph connection using gRPC client, even though the Port is wrong its not throwing an error

How to check the connection whether the connection is established sucessfully and how to do health checks for the connection

Point me to the documentation if any

Thank you

```auto
func newClient() *dgo.Dgraph {
	// Dial a gRPC connection. The address to dial to can be configured when
	// setting up the dgraph cluster.
	d, err := grpc.Dial("localhost:9080", grpc.WithInsecure())
	if err != nil {
		log.Fatal(err)
	}
	return dgo.NewDgraphClient(
		api.NewDgraphClient(d),
	)
}

```

---

<div class="post-metadata">

**Author:** ![Naman](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/naman/32/3498_2.png) [@Naman](https://discuss.dgraph.io/u/Naman)\
**Post date:** [June 12, 2020, 3:22pm UTC](https://discuss.dgraph.io/t/health-check-using-grpc-client/7154/2 "2020-06-12T15:22:47Z")

</div>

@teja

> [@teja](#):
>
> I am trying to establish Dgraph connection using gRPC client, even though the Port is wrong its not throwing an error.

It does not throw an error at the time of the creation of the client. It just initializes the structures. However, if you try to connect to the alpha for query, mutation etc., it throws an error. (try altering the schema [https://dgraph.io/docs/clients/#alter-the-database](https://dgraph.io/docs/clients/#alter-the-database))That’s when the client contacts the alpha.

> [@teja](#):
>
> How to check the connection whether the connection is established sucessfully and how to do health checks for the connection

If you want to do health check connection establishment via client then sending a low payload request could be one simple way. Logs at server might be another useful way. Maybe @dmai, @MichelDiz can point you with some other methods. You can look at [https://godoc.org/github.com/dgraph-io/dgo](https://godoc.org/github.com/dgraph-io/dgo) for other available APIs of Dgraph go-client.

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [June 12, 2020, 9:06pm UTC](https://discuss.dgraph.io/t/health-check-using-grpc-client/7154/3 "2020-06-12T21:06:15Z")

</div>

I think that no client can do this. I have been there heheheh → [Fetch health condition (enhancement) · Issue #27 · dgraph-io/dgraph-js · GitHub](https://github.com/dgraph-io/dgraph-js/issues/27)

But, you can check this using admin GraphQL query. You can use a small GraphQL client to “ping” this.

 ![Captura de Tela 2020-06-12 às 17.58.11](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/7/78442cb7a6d71c93776a3bdd5cc6e8dbc39a96ae.png)

> Instance: String  
> Node type : either ‘alpha’ or ‘zero’.
> 
> address: String  
> Address of the node.
> 
> status: [String  
> Node health status : either ‘healthy’ or ‘unhealthy’.
> 
> group: [String  
> The group this node belongs to in the Dgraph cluster. See : [Self-managed cluster - Deploy](https://dgraph.io/docs/deploy/#cluster-setup).
> 
> version: String  
> Version of the Dgraph binary.
> 
> uptime: Int  
> Time in nanoseconds since the node started.
> 
> lastEcho: Int  
> Time in Unix epoch time that the node was last contacted by another Zero or Alpha node.
> 
> ongoing: [String]  
> List of ongoing operations in the background.
> 
> indexing: [String]  
> List of predicates for which indexes are built in the background.
> 
> ee\_features: [String]  
> List of Enterprise Features that are enabled.
