Skip to content

Commit

Permalink
Merge pull request #4450 from influxdb/md-flags-override
Browse files Browse the repository at this point in the history
Flags overwriting config file
  • Loading branch information
desa committed Oct 14, 2015
2 parents 82f104a + 359f50f commit 7870b84
Showing 1 changed file with 35 additions and 24 deletions.
59 changes: 35 additions & 24 deletions cmd/influx_stress/influx_stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,61 @@ import (
)

var (
batchSize = flag.Int("batchsize", 5000, "number of points per batch")
seriesCount = flag.Int("series", 100000, "number of unique series to create")
pointCount = flag.Int("points", 100, "number of points per series to create")
concurrency = flag.Int("concurrency", 10, "number of simultaneous writes to run")
batchSize = flag.Int("batchsize", 0, "number of points per batch")
concurrency = flag.Int("concurrency", 0, "number of simultaneous writes to run")
batchInterval = flag.Duration("batchinterval", 0*time.Second, "duration between batches")
database = flag.String("database", "stress", "name of database")
address = flag.String("addr", "localhost:8086", "IP address and port of database (e.g., localhost:8086)")
precision = flag.String("precision", "n", "The precision that points in the database will be with")
database = flag.String("database", "", "name of database")
address = flag.String("addr", "", "IP address and port of database (e.g., localhost:8086)")
precision = flag.String("precision", "", "The precision that points in the database will be with")
test = flag.String("test", "", "The stress test file")
)

var ms runner.Measurements

func init() {
flag.Var(&ms, "m", "comma-separated list of intervals to use between events")
}

func main() {
var cfg *runner.Config
var err error

runtime.GOMAXPROCS(runtime.NumCPU())
flag.Parse()

cfg = runner.NewConfig()
if *test == "" {
fmt.Println("'-test' flag is required")
return
}

if len(ms) == 0 {
ms = append(ms, "cpu")
cfg, err = runner.DecodeFile(*test)
if err != nil {
fmt.Println(err)
return
}

for _, m := range ms {
cfg.Series = append(cfg.Series, runner.NewSeries(m, 100, 100000))
fmt.Printf("%#v\n", cfg.Write)

if *batchSize != 0 {
cfg.Write.BatchSize = *batchSize
}

if *test != "" {
cfg, err = runner.DecodeFile(*test)
if *concurrency != 0 {
cfg.Write.Concurrency = *concurrency
}

if err != nil {
fmt.Println(err)
return
}
if *batchInterval != 0*time.Second {
cfg.Write.BatchInterval = batchInterval.String()
}

if *database != "" {
cfg.Write.Database = *database
}

if *address != "" {
cfg.Write.Address = *address
}

if *precision != "" {
cfg.Write.Precision = *precision
}

fmt.Printf("%#v\n", cfg.Write)

d := make(chan struct{})
seriesQueryResults := make(chan runner.QueryResults)

Expand Down

0 comments on commit 7870b84

Please sign in to comment.