in apps/simple-backend/main.go [24:49]
func main() {
http.Handle("/", xray.Handler(xray.NewFixedSegmentNamer(appName), http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
res := &response{Message: "42 - The Answer to the Ultimate Question of Life, The Universe, and Everything.", Random: []int{}}
count := time.Now().Second()
gen := random(res)
_, seg := xray.BeginSubsegment(r.Context(), appName+"-gen")
for i := 0; i < count; i++ {
gen()
}
seg.Close(nil)
// Beautify the JSON output - only for display
out, _ := json.MarshalIndent(res, "", " ")
w.Header().Set("Content-Type", "application/json")
io.WriteString(w, string(out))
})))
http.ListenAndServe(":8080", nil)
}