-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
94 lines (80 loc) · 1.97 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package main
import (
"flag"
"github.com/getsentry/sentry-go"
_ "github.com/mattn/go-sqlite3"
"math/rand"
"net/http"
"time"
)
var (
all *bool
ignore *bool
traceIds []string
filePrefix *string
config Config
n *int
counter int
platforms []string
httpClient *http.Client
)
const JAVASCRIPT = "javascript"
const PYTHON = "python"
const JAVA = "java"
const RUBY = "ruby"
const GO = "go"
const PHP = "php"
const NODE = "node"
const DART = "dart"
const CSHARP = "csharp"
const ELIXIR = "elixir"
const PERL = "perl"
const RUST = "rust"
const COCOA = "cocoa"
const ANDROID = "android"
const FLUTTER = "flutter"
const CORDOVA = "cordova"
const NATIVE = "native"
const REACTNATIVE = "react-native"
const UNITY = "unity"
const ELECTRON = "electron"
const MAUI = "maui"
func init() {
parseYamlConfig()
initializeSentry()
sentry.CaptureMessage("job started")
ignore = flag.Bool("i", false, "ignore sending the event to Sentry.io")
n = flag.Int("n", 25, "default number of events to read from a source")
defaultPrefix := "error"
filePrefix = flag.String("prefix", defaultPrefix, "file prefix")
flag.Parse()
platforms = []string{
JAVASCRIPT, PYTHON, JAVA, RUBY, GO, NODE, PHP, CSHARP, DART, ELIXIR, PERL,
RUST, COCOA, ANDROID, FLUTTER, CORDOVA, NATIVE, REACTNATIVE, UNITY, ELECTRON, MAUI,
}
httpClient = &http.Client{}
// For randomizing the burst of events sent in requests.go
rand.Seed(time.Now().UnixNano())
}
func main() {
demoAutomation := DemoAutomation{}
events := demoAutomation.getEventsFromGCS()
for _, event := range events {
if event.Kind == ERROR || event.Kind == DEFAULT {
event.Error.eventId()
event.Error.release()
event.Error.user()
event.Error.timestamp()
}
if event.Kind == TRANSACTION {
event.Transaction.eventId()
event.Transaction.release()
event.Transaction.user()
event.Transaction.timestamps()
}
}
getTraceIds(events)
updateTraceIds(events)
requests := Requests{events}
requests.send()
}