Hi All,
I am able to create a health url for temporal front end but when i am trying the same for matching Service and history service it is not working as expected . Please find the code below .
How to create historyservice.HistoryServiceClient using golang .
const (
frontendService = “temporal.api.workflowservice.v1.WorkflowService”
matchingService = “temporal.api.workflowservice.v1.MatchingService”
historyService = “temporal.api.workflowservice.v1.HistoryService”
)
func temporalMatchingHealth(c *gin.Context) {
hostPort := "localhost:7233"
grpcSecurityOptions := grpc.WithInsecure()
dialOpts := []grpc.DialOption{
grpcSecurityOptions,
}
connection, _ := grpc.Dial(hostPort, dialOpts...)
healthClient := healthpb.NewHealthClient(connection)
req := &healthpb.HealthCheckRequest{
Service: matchingService,
}
resp, err := healthClient.Check(c, req)
if err != nil {
fmt.Printf("err@@@@$$$$%%%% ", err.Error())
}
fmt.Printf("%s: ", resp.Status)
fmt.Printf("resp.Status ", resp)
fmt.Printf("resp.Status ", resp)
fmt.Printf("%s: ", req.GetService())
if resp.Status != healthpb.HealthCheckResponse_SERVING {
fmt.Println("1>>>>>",resp.Status)
//osExit(1)
}
fmt.Println("0>>>>>>",resp.Status)
}
func temporalHistoryHealth(c *gin.Context) {
hostPort := "localhost:7233"
grpcSecurityOptions := grpc.WithInsecure()
dialOpts := []grpc.DialOption{
grpcSecurityOptions,
}
connection, _ := grpc.Dial(hostPort, dialOpts...)
client := historyservice.NewHistoryServiceClient(connection)
client.DescribeHistoryHost(c,req,dialOpts)
}
func temporalFrontendHealth(c *gin.Context) {
hostPort := "localhost:7233"
grpcSecurityOptions := grpc.WithInsecure()
dialOpts := []grpc.DialOption{
grpcSecurityOptions,
}
connection, _ := grpc.Dial(hostPort, dialOpts...)
healthClient := healthpb.NewHealthClient(connection)
req := &healthpb.HealthCheckRequest{
Service: frontendService,
}
resp, err := healthClient.Check(c, req)
if err != nil {
fmt.Printf("err@@@@$$$$%%%% ", err.Error())
}
fmt.Printf("%s: ", resp.Status)
fmt.Printf("resp.Status ", resp.Status)
fmt.Printf("resp.Status ", resp)
fmt.Printf("%s: ", req.GetService())
if resp.Status != healthpb.HealthCheckResponse_SERVING {
fmt.Println("1>>>>>",resp.Status)
//osExit(1)
}
fmt.Println("0>>>>>>",resp.Status)
//c.SecureJSON(http.StatusOK, strings.Join(defaultDataConverter.ToStrings(resp), ", "))
}