-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
scenario-withConnect.js
40 lines (34 loc) · 842 Bytes
/
scenario-withConnect.js
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
const { loggingTransport } = require('@sentry-internal/node-integration-tests');
const Sentry = require('@sentry/node');
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
tracesSampleRate: 1.0,
transport: loggingTransport,
});
// Stop the process from exiting before the transaction is sent
setInterval(() => {}, 1000);
const mysql = require('mysql');
const connection = mysql.createConnection({
user: 'root',
password: 'docker',
});
connection.connect(function (err) {
if (err) {
return;
}
});
Sentry.startSpanManual(
{
op: 'transaction',
name: 'Test Transaction',
},
span => {
connection.query('SELECT 1 + 1 AS solution', function () {
connection.query('SELECT NOW()', ['1', '2'], () => {
span.end();
connection.end();
});
});
},
);