@compas/stdlib
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -18,2 +18,2 @@ export { uuid } from "./src/datatypes.js"; | ||
export { newEvent, eventStart, eventRename, eventStop, newEventFromEvent } from "./src/events.js"; | ||
export { _compasSentryExport, compasWithSentry } from "./src/sentry.js"; | ||
export { _compasSentryExport, compasWithSentry, _compasSentryEnableQuerySpans } from "./src/sentry.js"; |
@@ -96,2 +96,6 @@ /// <reference path="./types/advanced-types.d.ts"> | ||
export { _compasSentryExport, compasWithSentry } from "./src/sentry.js"; | ||
export { | ||
_compasSentryExport, | ||
compasWithSentry, | ||
_compasSentryEnableQuerySpans, | ||
} from "./src/sentry.js"; |
{ | ||
"name": "@compas/stdlib", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "All kinds of utility functions", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -165,3 +165,3 @@ import { AppError } from "./error.js"; | ||
event._compasSentrySpan = _compasSentryExport.startInactiveSpan({ | ||
op: "event", | ||
op: "function", | ||
name: name, | ||
@@ -235,5 +235,3 @@ description: name, | ||
event._compasSentrySpan.end(); | ||
} | ||
if (isNil(event.rootEvent)) { | ||
} else if (isNil(event.rootEvent)) { | ||
event.log.info({ | ||
@@ -240,0 +238,0 @@ type: "event_span", |
@@ -8,3 +8,3 @@ /** | ||
* Meaning that further logs are not necessarily correlated to the correct event. | ||
* This can be inferred based on the timeline. | ||
* The final event callstack is not logged. | ||
* | ||
@@ -19,16 +19,20 @@ * Server: | ||
* - If the error handler retrieves an unknown or AppError.serverError, it is reported as an uncaught exception. | ||
* It is advised to set 'maxDepth' to '0' in your Sentry config, and to enable the 'extraErrorDataIntegration' integration. | ||
* It is advised to set 'normalizeDepth' to '0' in your Sentry config, and to enable the 'extraErrorDataIntegration' integration. | ||
* | ||
* Queue: | ||
* - Starts a new root span for each handled Job | ||
* - Names it based on the job name. | ||
* - Reports unhandled errors as exceptions. | ||
* Store: | ||
* - Starts a new root span for each handled Job in the QueueWorker | ||
* The span name is based on the job name. Unhandled errors are captured as exceptions. | ||
* - Supports passing queries to Sentry as spans. Requires {@link opts.sendQueriesAsSpans} to be set. | ||
* | ||
* All: | ||
* - Each package that has error logs, will report an exception as well. | ||
* - Note that we still execute the logs for now. Which may be removed in a future release. | ||
* - All error logs in Compas package code are captured as exceptions. | ||
* | ||
* @param {import("@sentry/node")} instance | ||
* @param {{ | ||
* sendQueriesAsSpans?: boolean | ||
* }} [opts] | ||
*/ | ||
export function compasWithSentry(instance: typeof import("@sentry/node")): void; | ||
export function compasWithSentry(instance: typeof import("@sentry/node"), { sendQueriesAsSpans }?: { | ||
sendQueriesAsSpans?: boolean | undefined; | ||
} | undefined): void; | ||
/** | ||
@@ -40,1 +44,7 @@ * The Sentry version that all Compas packages use if set via {@link compasWithSentry}. | ||
export let _compasSentryExport: undefined | typeof import("@sentry/node"); | ||
/** | ||
* Send queries executed via `query` from @compas/store as a sentry span. | ||
* | ||
* @type {boolean} | ||
*/ | ||
export let _compasSentryEnableQuerySpans: boolean; |
@@ -9,2 +9,9 @@ /** | ||
/** | ||
* Send queries executed via `query` from @compas/store as a sentry span. | ||
* | ||
* @type {boolean} | ||
*/ | ||
export let _compasSentryEnableQuerySpans = false; | ||
/** | ||
* Enable Sentry support. This comes with the following changes: | ||
@@ -16,3 +23,3 @@ * | ||
* Meaning that further logs are not necessarily correlated to the correct event. | ||
* This can be inferred based on the timeline. | ||
* The final event callstack is not logged. | ||
* | ||
@@ -27,17 +34,20 @@ * Server: | ||
* - If the error handler retrieves an unknown or AppError.serverError, it is reported as an uncaught exception. | ||
* It is advised to set 'maxDepth' to '0' in your Sentry config, and to enable the 'extraErrorDataIntegration' integration. | ||
* It is advised to set 'normalizeDepth' to '0' in your Sentry config, and to enable the 'extraErrorDataIntegration' integration. | ||
* | ||
* Queue: | ||
* - Starts a new root span for each handled Job | ||
* - Names it based on the job name. | ||
* - Reports unhandled errors as exceptions. | ||
* Store: | ||
* - Starts a new root span for each handled Job in the QueueWorker | ||
* The span name is based on the job name. Unhandled errors are captured as exceptions. | ||
* - Supports passing queries to Sentry as spans. Requires {@link opts.sendQueriesAsSpans} to be set. | ||
* | ||
* All: | ||
* - Each package that has error logs, will report an exception as well. | ||
* - Note that we still execute the logs for now. Which may be removed in a future release. | ||
* - All error logs in Compas package code are captured as exceptions. | ||
* | ||
* @param {import("@sentry/node")} instance | ||
* @param {{ | ||
* sendQueriesAsSpans?: boolean | ||
* }} [opts] | ||
*/ | ||
export function compasWithSentry(instance) { | ||
export function compasWithSentry(instance, { sendQueriesAsSpans } = {}) { | ||
_compasSentryExport = instance; | ||
_compasSentryEnableQuerySpans = sendQueriesAsSpans ?? false; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74287
2451