Skip to content

Commit

Permalink
Add profiling (trufflesecurity#38)
Browse files Browse the repository at this point in the history
* capture caught exceptions

* add profiling

* Use 0.0.12 for now
  • Loading branch information
dustin-decker authored Jan 31, 2023
1 parent 1b7aa32 commit 42fcdf0
Show file tree
Hide file tree
Showing 4 changed files with 1,014 additions and 52 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM node:16
FROM node:16-bullseye

RUN mkdir /app/
WORKDIR /app/
RUN npm install pm2 -g
RUN apt update; apt install -y libstdc++6

COPY front-end/ /app/front-end/
WORKDIR /app/front-end/
Expand Down
17 changes: 9 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const validate = require('express-jsonschema').validate;
const constants = require('./constants.js');
const Sentry = require('@sentry/node');
const Tracing = require("@sentry/tracing");
const Profiling = require("@sentry/profiling-node");

function set_secure_headers(req, res) {
res.set("X-XSS-Protection", "mode=block");
Expand Down Expand Up @@ -58,15 +59,15 @@ async function get_app_server() {
Sentry.init({
dsn: process.env.SENTRY_DSN,
integrations: [
// enable HTTP calls tracing
new Sentry.Integrations.Http({ tracing: true }),
// enable Express.js middleware tracing
new Tracing.Integrations.Express({ app }),
// enable HTTP calls tracing
new Sentry.Integrations.Http({ tracing: true }),
// enable Express.js middleware tracing
new Tracing.Integrations.Express({ app }),
// add beta profiling integration
new Profiling.ProfilingIntegration()
],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
// 1.0 is 100% capture rate
profilesSampleRate: 1.0,
tracesSampleRate: 0.01,
});

Expand Down
Loading

0 comments on commit 42fcdf0

Please sign in to comment.