// connectToKibana returns a function which attempts to connect to a kibana server and ping it using the endpoint provided.
// It will ping the api status endpoint and wait for a 200 to be returned on it.
connectToKibana returns a function which attempts to connect to a kibana server and ping it using the endpoint provided.
It will ping the api status endpoint and wait for a 200 to be returned on it.
// connectToKibana returns a function which attempts to connect to a kibana server and ping it using the endpoint provided . // It will ping the api status endpoint and wait for a 200 to be returned on it .
func connectToKibana(endpoint string) func() error {
	return func() error {
		client := &http.Client{
			Timeout: time.Second * 1,
		}
		resp, err := client.Get(fmt.Sprintf("%v/api/status", endpoint))
		if err != nil {
			return errors.Wrap(err, "get on kibana status")
		}
		if resp.StatusCode != 200 {
			return fmt.Errorf("service returning %v", resp.StatusCode)
		}
		return nil
	}
}
func connectToKibana ( endpoint string ) func ( ) error { return func ( ) error { client := & http . Client { Timeout : time . Second * 1 , } resp , err := client . Get ( fmt . Sprintf ( " " , endpoint ) ) if err != nil { return errors . Wrap ( err , " " ) } if resp . StatusCode != 200 { return fmt . Errorf ( " " , resp . StatusCode ) } return nil } }
connectToKibana returns a function which attempts to connect to a kibana server and ping it using the endpoint provided.
connectToKibana returns a function which attempts to connect to a kibana server and ping it using the endpoint provided .