All files / server/src/utils instrument.ts

57.14% Statements 4/7
0% Branches 0/6
100% Functions 1/1
57.14% Lines 4/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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        5x 5x           5x               5x                    
import { init } from "@sentry/node";
import { config } from "shared/config";
import { scrubIpAddress } from "server/utils/scrubIpAddress";
 
const getDsn = (): string | undefined => {
  switch (process.env.SETTINGS) {
    case "production":
      return "https://0278d6bfb3f04c70acf826ecbd86ae58@o1321706.ingest.sentry.io/6579204";
    case "staging":
      return "https://ab176c60aac24be8af2f6c790f1437ac@o1321706.ingest.sentry.io/6578390";
    case "development":
      return config.sentry().enableSentryInDev
        ? "https://6f41ef28d9664c1a8c3e25f58cecacf7@o1321706.ingest.sentry.io/6579493"
        : undefined;
    default:
      return undefined;
  }
};
 
init({
  dsn: getDsn(),
  tracesSampleRate: config.sentry().tracesSampleRate,
  environment: process.env.SETTINGS,
  // Set in the runner image to the git SHA, matching the release created in
  // deploy.yml so backend events are associated with it (undefined locally)
  release: process.env.SENTRY_RELEASE,
  maxValueLength: config.sentry().maxValueLength,
  beforeSend: scrubIpAddress,
});