-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
56 lines (41 loc) · 1.3 KB
/
app.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// This file NEEDS to be CommonJS. Opentelemetry does not work with
// ESM modules. So, we use commonJS and import the app file
// at the bottom.
const Sentry = require("@sentry/node");
const express = require("express");
const { Integrations } = require("@sentry/tracing");
const { ProfilingIntegration } = require("@sentry/profiling-node");
const app = express();
Sentry.init({
dsn: "MY_DSN_HERE",
enabled: true,
debug: true,
instrumenter: "otel",
release: "testing",
environment: "sentry-reproduction",
tracesSampleRate: 1.0,
profilesSampleRate: 1.0, // Profiling sample rate is relative to tracesSampleRate
beforeSend: (event) => {
console.log("Testing");
return event;
},
integrations: [
new Integrations.Express({ app }),
new Sentry.Integrations.Http({ tracing: true }),
new ProfilingIntegration(),
],
});
// The request handler must be the first middleware on the app
app.use(Sentry.Handlers.requestHandler());
//app.use(Sentry.Handlers.tracingHandler());
app.get("/", function (req, res) {
Sentry.addBreadcrumb({
message: "Custom Breadcrumb Inserted",
});
console.log("Triggered route");
return res.json({ success: true });
});
const port = process.env.PORT || 8085;
app.listen(port, () => {
console.log(`http server listening on port ${port}`);
});