-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
136 lines (113 loc) · 4.17 KB
/
index.html
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<html>
<head>
<title>JS test</title>
<script src="https://browser.sentry-cdn.com/5.19.1/bundle.apm.js" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
</head>
<body>
<script>
window.runtime = (new Date()).toLocaleString()
function log(str) {
//console.log(str)
$("#log").html(str)
}
console.log("Running at " + window.runtime)
// dave-test/billing-test
Sentry.init({
dsn: 'https://c95e5819c990417eb8c6873a5fa9c47f@o194887.ingest.sentry.io/5316387',
integrations: [new Sentry.Integrations.Tracing()],
tracesSampleRate: 1,
});
function change_dsn() {
//dave-test/javascript: https://8995c2427a3845688fac1988f3c50053@o194887.ingest.sentry.io/1299501
Sentry.init({
dsn: $("#dsn").val(),
integrations: [new Sentry.Integrations.Tracing()],
tracesSampleRate: 1,
});
}
function send_events(n, total, span, func) {
state= n+"/"+total
//console.log(state)
$("#"+span).html(state)
eval(func)
if(n<total) {
window.setTimeout("send_events("+(n+1)+", "+total+", '"+span+"', '"+func+"')",200)
} else {
log("Sent " + total + ": "+ func)
}
}
function send_transaction() {
var name = 'transaction '+ window.runtime + " - " + Date.now()+Math.random();
const transaction = Sentry.startTransaction({
name: name
});
const span = transaction.startChild({
op: 'functionX'
}); // This function returns a Span
// functionCallX
span.finish(); // Remember that only finished spans will be sent with the transaction
transaction.finish(); // Finishing the transaction will send it to Sentry
log('sent ' + name)
}
function send_error() {
var name = 'error '+ window.runtime + " - " + Date.now()+Math.random();
Sentry.captureException(new Error("Error "+name));
log('sent ' + name)
}
</script>
<h1>Send a lot of JavaScript Traffic</h1>
Notes:
<ul>
<li>Turn off spike protection
<li>If you are using a paid account, this will cost real money
<li>It may take a few minutes for traffic to show up
<li>There's a 0.2s delay beteween events, so it can take a long time if you're sending 1MM of anything
</ul>
<div id="log"></div>
<h2>DSN</h2>
<input type=text size=80 value="https://c95e5819c990417eb8c6873a5fa9c47f@o194887.ingest.sentry.io/5316387"
onchange ="change_dsn()" id='dsn'>
<input type="button" value="change"> <!-- dummy button to get people to trigger the onchange-->
<h2>Send Errors</h2>
<input type=button value="Send 10 errors"
onclick = "send_events(1, 10, 'errs', 'send_error()')"
/>
<input type=button value="Send 100 errors"
onclick = "send_events(1, 100, 'errs', 'send_error()')"
/>
<input type=button value="Send 1,000 errors"
onclick = "send_events(1, 1000, 'errs', 'send_error()')"
/>
<input type=button value="Send 10,000 errors"
onclick = "send_events(1, 10000, 'errs', 'send_error()')"
/>
<input type=button value="Send 50,000 errors"
onclick = "send_events(1, 50000, 'errs', 'send_error()')"
/>
<input type=button value="Send 100,000 errors"
onclick = "send_events(1, 100000, 'errs', 'send_error()')"
/>
<span id="errs"></span>
<h2>Send Transactions</h2>
<input type=button value="Send 10 transactions"
onclick = "send_events(1, 10, 'ts', 'send_transaction()')"
/>
<input type=button value="Send 100 transactions"
onclick = "send_events(1, 100, 'ts', 'send_transaction()')"
/>
<input type=button value="Send 1,000 transactions"
onclick = "send_events(1, 1000, 'ts', 'send_transaction()')"
/>
<input type=button value="Send 10,000 transactions"
onclick = "send_events(1, 10000, 'ts', 'send_transaction()')"
/>
<input type=button value="Send 100,000 transactions"
onclick = "send_events(1, 100000, 'ts', 'send_transaction()')"
/>
<input type=button value="Send 1,000,000 transactions"
onclick = "send_events(1, 1000000, 'ts', 'send_transaction()')"
/>
<span id="ts"></span>
</body>
</html>