func PollItself()

in observability/workload-metrics/main.go [63:79]


func PollItself() {
	for {
		resp, err := http.Get("http://localhost:1234/")
		if err != nil {
			logger.Sugar().Errorf("HTTP request failed: %w", err)
		} else {
			body, err := ioutil.ReadAll(resp.Body)
			if err != nil {
				logger.Sugar().Errorf("Failed to read response: %w", err)
			} else {
				logger.Sugar().Debugf("Response: %s", string(body))
				_ = resp.Body.Close()
			}
		}
		time.Sleep(time.Second * time.Duration(rand.Intn(3)))
	}
}