Skip to content

Commit 6b1abc7

Browse files
committed
gitignore
1 parent 492be58 commit 6b1abc7

File tree

2 files changed

+65
-3
lines changed

2 files changed

+65
-3
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
nozzle.sh
44

5-
tools/*
6-
!tools/*.template
7-
!tools/*.go
5+
tools/dump_app_info/dump_app_info
6+
tools/data_gen/data_gen
87

98
cache.db
109
*.out

tools/data_gen/data_gen.go

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"strconv"
7+
"time"
8+
)
9+
10+
type config struct {
11+
EPS int64
12+
TotalEvents int64
13+
}
14+
15+
func getIntEnv(key string, defaultValue int64) int64 {
16+
valStr := os.Getenv(key)
17+
if len(valStr) == 0 {
18+
return defaultValue
19+
}
20+
21+
if val, err := strconv.ParseInt(valStr, 10, 64); err == nil {
22+
return val
23+
}
24+
return defaultValue
25+
}
26+
27+
func getConfig() *config {
28+
c := config{}
29+
c.EPS = getIntEnv("EPS", 10)
30+
c.TotalEvents = getIntEnv("TOTAL_EVENTS", 0)
31+
return &c
32+
}
33+
34+
func main() {
35+
c := getConfig()
36+
37+
durationPerEvent := time.Duration(int64(time.Second) / c.EPS)
38+
ticker := time.NewTicker(durationPerEvent)
39+
40+
uuid := time.Now().UnixNano()
41+
totalGen := int64(0)
42+
for {
43+
select {
44+
case <-ticker.C:
45+
totalGen += 1
46+
fmt.Printf(`{"annotation": "uuid=%d generate data id=%d", "@timestamp":"2017-07-18T22:48:59.763Z","source_host":"1ajkpfgpagq","file":"Dsc2SubsystemAmqpListner.java","method":"spawnNewSubsystemHandler","level":"INFO","line_number":"101","thread_name":"bundle-97-ActorSystem-akka.actor.default-dispatcher-5","@version":1,"logger_name":"com.proximetry.dsc2.listners.Dsc2SubsystemAmqpListner","message":"blahblah-blah|blahblahblah|dsc2| KeyIdRequest :KeyIdRequest(key:xxxxxxxxxxx, id:-xxxxxxxxxxxxxxxxxxx)","class":"com.proximetry.dsc2.listners.Dsc2SubsystemAmqpListner","mdc":{"bundle.version":"0.0.1.SNAPSHOT","bundle.name":"com.proximetry.dsc2","bundle.id":97}}`, uuid, totalGen)
47+
fmt.Println("")
48+
}
49+
50+
if c.TotalEvents > 0 && totalGen >= c.TotalEvents {
51+
break
52+
}
53+
}
54+
fmt.Printf("end loop\n")
55+
56+
taken := time.Now().UnixNano() - uuid
57+
58+
fmt.Printf("uuid=%d data generation done, taken=%f seconds\n", uuid, float64(taken)/float64(time.Second))
59+
for {
60+
fmt.Printf("uuid=%d data generation done, taken=%f seconds\n", uuid, float64(taken)/float64(time.Second))
61+
time.Sleep(30 * time.Second)
62+
}
63+
}

0 commit comments

Comments
 (0)