func init()

in cmd/apmbench/config.go [34:94]


func init() {
	cfg.AgentsList = []int{1}

	flag.UintVar(&cfg.Count, "count", 1, "run benchmarks `n` times")
	flag.StringVar(&cfg.Benchtime, "benchtime", "1s", "run each benchmark for duration `d` or N times if `d` is of the form Nx")
	flag.Func("run", "run only benchmarks matching `regexp`", func(restr string) error {
		if restr != "" {
			re, err := regexp.Compile(restr)
			if err != nil {
				return err
			}
			cfg.RunRE = re
		}
		return nil
	})
	flag.Func("skip", "skip benchmarks matching `regexp`", func(restr string) error {
		if restr != "" {
			re, err := regexp.Compile(restr)
			if err != nil {
				return err
			}
			cfg.SkipRE = re
		}
		return nil
	})
	flag.Func("agents", "comma-separated `list` of agent counts to run each benchmark with",
		func(agents string) error {
			var agentsList []int
			for _, val := range strings.Split(agents, ",") {
				val = strings.TrimSpace(val)
				if val == "" {
					continue
				}
				n, err := strconv.Atoi(val)
				if err != nil || n <= 0 {
					return fmt.Errorf("invalid value %q for -agents", val)
				}
				agentsList = append(agentsList, n)
			}
			sort.Ints(agentsList)
			cfg.AgentsList = agentsList
			return nil
		},
	)
	flag.StringVar(&cfg.BenchmarkTelemetryEndpoint, "benchmark-telemetry-endpoint", "", "Telemetry endpoint that exposed benchmark telemetry data with reset capabilities")
	flag.Func("cleanup-keys", "comma-separated `list` of metric keys returned by the telemetry endpoint to monitor cleanup status after a benchmark run",
		func(raw string) error {
			var keys []string
			for _, val := range strings.Split(raw, ",") {
				val = strings.TrimSpace(val)
				if val == "" {
					continue
				}
				keys = append(keys, val)
			}
			cfg.CleanupKeys = keys
			return nil
		},
	)
	flag.BoolVar(&cfg.Debug, "debug", false, "setup debug logging level")
}