diff --git a/cmd/avalanche.go b/cmd/avalanche.go index 489a1e4..8ecdbb9 100644 --- a/cmd/avalanche.go +++ b/cmd/avalanche.go @@ -69,7 +69,7 @@ func main() { remotePprofURLs := kingpin.Flag("remote-pprof-urls", "a list of urls to download pprofs during the remote write: --remote-pprof-urls=http://127.0.0.1:10902/debug/pprof/heap --remote-pprof-urls=http://127.0.0.1:10902/debug/pprof/profile").URLList() remotePprofInterval := kingpin.Flag("remote-pprof-interval", "how often to download pprof profiles. When not provided it will download a profile once before the end of the test.").Duration() remoteBatchSize := kingpin.Flag("remote-batch-size", "how many samples to send with each remote_write API request.").Default("2000").Int() - remoteRequestCount := kingpin.Flag("remote-requests-count", "how many requests to send in total to the remote_write API.").Default("100").Int() + remoteRequestCount := kingpin.Flag("remote-requests-count", "How many requests to send in total to the remote_write API. Set to -1 to run indefinitely.").Default("100").Int() remoteReqsInterval := kingpin.Flag("remote-write-interval", "delay between each remote write request.").Default("100ms").Duration() remoteTenant := kingpin.Flag("remote-tenant", "Tenant ID to include in remote_write send").Default("0").String() tlsClientInsecure := kingpin.Flag("tls-client-insecure", "Skip certificate check on tls connection").Default("false").Bool() diff --git a/metrics/write.go b/metrics/write.go index 8c66faa..8b4aa6c 100644 --- a/metrics/write.go +++ b/metrics/write.go @@ -128,14 +128,14 @@ func (c *Client) write(ctx context.Context) error { log.Printf("Sending: %v timeseries, %v samples, %v timeseries per request, %v delay between requests\n", len(tss), c.config.RequestCount, c.config.BatchSize, c.config.RequestInterval) ticker := time.NewTicker(c.config.RequestInterval) defer ticker.Stop() - for ii := 0; ii < c.config.RequestCount; ii++ { + for ii := 0; c.config.RequestCount == -1 || ii < c.config.RequestCount; ii++ { if ctx.Err() != nil { return ctx.Err() } // Download the pprofs during half of the iteration to get avarege readings. // Do that only when it is not set to take profiles at a given interval. - if len(c.config.PprofURLs) > 0 && ii == c.config.RequestCount/2 { + if len(c.config.PprofURLs) > 0 && c.config.RequestCount != -1 && ii == c.config.RequestCount/2 { wgPprof.Add(1) go func() { download.URLs(c.config.PprofURLs, time.Now().Format("2-Jan-2006-15:04:05"))