func main()

in step3/src/loadgen/main.go [81:110]


func main() {
	// step1. setup OpenTelemetry
	tp, err := initTracer()
	if err != nil {
		log.Fatalf("failed to initialize TracerProvider: %v", err)
	}
	defer func() {
		if err := tp.Shutdown(context.Background()); err != nil {
			log.Fatalf("error shutting down TracerProvider: %v", err)
		}
	}()
	// step1. end setup

	log.Printf("starting worder with %d workers in %d concurrency", numWorkers, numConcurrency)
	log.Printf("number of rounds: %d (0 is inifinite)", numRounds)

	t := time.NewTicker(time.Duration(intervalMs) * time.Millisecond)
	i := 0
	for range t.C {
		log.Printf("simulating client requests, round %d", i)
		if err := run(numWorkers, numConcurrency); err != nil {
			log.Printf("aborted round with error: %v", err)
		}
		log.Printf("simulated %d requests", numWorkers)
		if numRounds != 0 && i > numRounds {
			break
		}
		i++
	}
}