Update urlgen to end at current time.

pull/1935/head
Ben Johnson 2015-03-12 15:04:36 -06:00
parent 7880bc2452
commit c7d49209e1
2 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ You can do this with the following commands:
```sh
$ curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE db"
$ curl -G http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY raw ON db DURATION 1h REPLICATION 1 DEFAULT"
$ curl -G http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY raw ON db DURATION 30d REPLICATION 3 DEFAULT"
```

View File

@ -11,17 +11,17 @@ func main() {
intervalN := flag.Int("interval", 10, "interval")
seriesN := flag.Int("series", 1, "Number of unique series to generate.")
clientN := flag.Int("clients", 10, "Number of clients to simulate.")
startDate := flag.String("start", time.Now().Format(time.RFC3339), "Date to start with.")
flag.Parse()
t, _ := time.Parse(time.RFC3339, *startDate)
oneSecond := 1 * time.Second
// Calculate time so that the last point ends now.
n := (*clientN) * (*seriesN) * (*intervalN)
t := time.Now().UTC().Add(-time.Duration(n) * time.Second)
for i := 0; i < *clientN; i++ {
for j := 0; j < *seriesN; j++ {
points := make([]*Point, 0)
for k := 0; k < *intervalN; k++ {
t = t.Add(oneSecond)
t = t.Add(1 * time.Second)
points = append(points, &Point{
Name: "cpu",
Timestamp: t,