UNPKG

1.72 kBTypeScriptView Raw
1/**
2 * Enable Sentry support. This comes with the following changes:
3 *
4 * Stdlib:
5 * - Logger: both info and error logs are added as breadcrumbs to the current active span.
6 * - Event: Events are propagated to Sentry as (inactive) spans.
7 * Meaning that further logs are not necessarily correlated to the correct event.
8 * This can be inferred based on the timeline.
9 *
10 * Server:
11 * - Starts a new root span for each incoming request.
12 * - Tries to name it based on the finalized name of `ctx.event`.
13 * This is most likely in the format `router.foo.bar` for matched routes by the generated router.
14 * - Uses the sentry-trace header when provided.
15 * Note that if a custom list of `allowHeaders` is provided in the CORS options,
16 * 'sentry-trace' and 'baggage' should be allowed as well.
17 * - If the error handler retrieves an unknown or AppError.serverError, it is reported as an uncaught exception.
18 * It is advised to set 'maxDepth' to '0' in your Sentry config, and to enable the 'extraErrorDataIntegration' integration.
19 *
20 * Queue:
21 * - Starts a new root span for each handled Job
22 * - Names it based on the job name.
23 * - Reports unhandled errors as exceptions.
24 *
25 * All:
26 * - Each package that has error logs, will report an exception as well.
27 * - Note that we still execute the logs for now. Which may be removed in a future release.
28 *
29 * @param {import("@sentry/node")} instance
30 */
31export function compasWithSentry(instance: typeof import("@sentry/node")): void;
32/**
33 * The Sentry version that all Compas packages use if set via {@link compasWithSentry}.
34 *
35 * @type {undefined|import("@sentry/node")}
36 */
37export let _compasSentryExport: undefined | typeof import("@sentry/node");