diff --git a/docs/platforms/javascript/common/configuration/filtering.mdx b/docs/platforms/javascript/common/configuration/filtering.mdx index deee544c3d5031..6a8c81933fbb1a 100644 --- a/docs/platforms/javascript/common/configuration/filtering.mdx +++ b/docs/platforms/javascript/common/configuration/filtering.mdx @@ -20,56 +20,15 @@ You can use the option to filter out +See ignoreErrors for details. + ### Using -You can configure a callback method to filter error events. Because it's called immediately before the event is sent to the server, this is your last chance to decide not to send data or to edit it. receives the event object as a parameter and, based on custom logic and the data available on the event, you can either modify the event’s data or drop it completely by returning `null`. +You can configure a callback method to filter error events. Because it's called immediately before the event is sent to the server, this is your last chance to decide not to send data or to edit it. receives the event object as a parameter and, based on custom logic and the data available on the event, you can either modify the event’s data or drop it completely by returning `null`. This hook is called for both error and message events. -Note also that breadcrumbs can be filtered, as discussed in [our Breadcrumbs documentation](/product/error-monitoring/breadcrumbs/). - -#### Event Hints - -The callback is passed both the `event` and a second argument, `hint`, that holds one or more hints. - -Typically, a `hint` holds the original exception so that additional data can be extracted or grouping is affected. In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught: - - - -When the SDK creates an event or breadcrumb for transmission, that transmission is typically created from some sort of source object. For instance, an error event is typically created from a log record or exception instance. For better customization, SDKs send these objects to certain callbacks (, or the event processor system in the SDK). - -### Using Hints - -Hints are available in two places: - -1. / -2. `eventProcessors` - -Event and breadcrumb `hints` are objects containing various information used to put together an event or a breadcrumb. Typically `hints` hold the original exception so that additional data can be extracted or grouping can be affected. - -For events, hints contain properties such as `event_id`, `originalException`, `syntheticException` (used internally to generate cleaner stack trace), and any other arbitrary `data` that you attach. - -For breadcrumbs, the use of `hints` is implementation dependent. For XHR requests, the hint contains the xhr object itself; for user interactions the hint contains the DOM element and event name and so forth. - - - -In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught: - - - -#### Hints for Events - -`originalException` - -The original exception that caused the Sentry SDK to create the event. This is useful for changing how the Sentry SDK groups events or to extract additional information. - -`syntheticException` - -When a string or a non-error object is raised, Sentry creates a synthetic exception so you can get a basic stack trace. This exception is stored here for further data extraction. - -#### Hints for Breadcrumbs - - +See beforeSend for details, and [Using Hints](#using-hints) for details on the `hint` object. ### Using `allowUrls` and `denyUrls` @@ -83,6 +42,9 @@ Sentry.init({ You can also use `denyUrls` if you want to block errors created on specific URLs from being sent to Sentry. +- See allowUrls details +- See denyUrls details + ### Using `thirdPartyErrorFilterIntegration` _Available in browser-based SDKs from version 8.10.0_ @@ -156,24 +118,20 @@ You can use the option to filt -### Using - -**Note:** The and config options are mutually exclusive. If you define a to filter out certain transactions, you must also handle the case of non-filtered transactions by returning the rate at which you'd like them sampled. +See ignoreTransactions for details. -In its simplest form, used just for filtering the transaction, it looks like this: - - - -It also allows you to sample different transactions at different rates. +### Using -If the transaction currently being processed has a parent transaction (from an upstream service calling this service), the parent (upstream) sampling decision will always be included in the sampling context data, so that your can choose whether and when to inherit that decision. In most cases, inheritance is the right choice, to avoid breaking distributed traces. A broken trace will not include all your services. See Inheriting the parent sampling decision to learn more. +You can also use the tracesSampler option to prevent certain transactions from being reported to Sentry. -Learn more about configuring the sample rate. +See Sampling on information about how to use it. ### Using `beforeSendTransaction` +See beforeSendTransaction for details, and [Using Hints](#using-hints) for details on the `hint` object. + ## Filtering Spans Use the configuration option which allows you to provide a function to modify a span. @@ -181,3 +139,46 @@ This function is called for the root span and all child spans. If you want to dr Please note that you cannot use `beforeSendSpan` to drop a span, you can only modify it and filter data on it. + +See beforeSendSpan for details. + +## Filtering Breadcrumbs + +You can filter breadcrumbs by using the `beforeBreadcrumb` configuration option: + + + +See beforeBreadcrumb for details. + +## Using Hints + +Hints are available in two places: + +1. / +2. Event processors added via `Sentry.addEventProcessor()` + +Event and breadcrumb `hints` are objects containing various types of information used to put together an event or a breadcrumb. Typically `hints` hold the original exception so that additional data can be extracted or grouping can be affected. + +For events, hints contain properties such as `event_id`, `originalException`, `syntheticException` (used internally to generate cleaner stack trace), and any other arbitrary `data` that you attach. + +For breadcrumbs, the use of `hints` is implementation dependent. For XHR requests, the hint contains the xhr object itself; for user interactions the hint contains the DOM element and event name and so forth. + + + +In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught: + + + +### Hints for Events + +`originalException` + +The original exception that caused the Sentry SDK to create the event. This is useful for changing how the Sentry SDK groups events or to extract additional information. + +`syntheticException` + +When a string or a non-error object is raised, Sentry creates a synthetic exception so you can get a basic stack trace. This exception is stored here for further data extraction. + +### Hints for Breadcrumbs + + diff --git a/docs/platforms/javascript/common/configuration/releases.mdx b/docs/platforms/javascript/common/configuration/releases.mdx index 1466da72764cdc..c0269868260f46 100644 --- a/docs/platforms/javascript/common/configuration/releases.mdx +++ b/docs/platforms/javascript/common/configuration/releases.mdx @@ -64,11 +64,6 @@ After configuring your SDK, you can install a repository integration or manually Monitor the [health of releases](/product/releases/health/) by observing user adoption, usage of the application, percentage of [crashes](/product/releases/health/#crash), and [session data](/product/releases/health/#session). Release health will provide insight into the impact of crashes and bugs as it relates to user experience, and reveal trends with each new issue through the [Release Details](/product/releases/release-details/) graphs and filters. - - -Crash reporting and app hang detection are not available for watchOS. - - In order to monitor release health, the SDK sends session data. @@ -77,3 +72,5 @@ In order to monitor release health, the SDK sends session data. A session represents the interaction between the user and the application. Sessions contain a timestamp, a status (if the session was OK or if it crashed), and are always linked to a release. Most Sentry SDKs can manage sessions automatically. + +See Session APIs for more information on how to manually capturing sessions. diff --git a/platform-includes/configuration/auto-session-tracking/javascript.mdx b/platform-includes/configuration/auto-session-tracking/javascript.mdx index a78508541f8c53..b26c6b0119a148 100644 --- a/platform-includes/configuration/auto-session-tracking/javascript.mdx +++ b/platform-includes/configuration/auto-session-tracking/javascript.mdx @@ -3,7 +3,7 @@ By default, the JavaScript Browser SDKs are sending sessions. We create a session for every page load. For single-page applications, we will create a new session for every navigation change (History API). -To disable sending sessions, disable the `BrowserSession` integration: +To disable the default sessions handling, disable the `BrowserSession` integration: ```javascript Sentry.init({ @@ -22,7 +22,7 @@ Sentry.init({ By default, the Node.js-based SDKs are sending sessions. Sessions are created for every incoming request. -To disable sending sessions, set `trackIncomingRequestsAsSessions: false` in the `httpIntegration`: +To disable the default sessions handling, set `trackIncomingRequestsAsSessions: false` in the `httpIntegration`: ```javascript import * as Sentry from "@sentry/node"; diff --git a/platform-includes/configuration/before-breadcrumb-hint/javascript.mdx b/platform-includes/configuration/before-breadcrumb-hint/javascript.mdx deleted file mode 100644 index b282ef1ba0320b..00000000000000 --- a/platform-includes/configuration/before-breadcrumb-hint/javascript.mdx +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -Sentry.init({ - // ... - beforeBreadcrumb(breadcrumb, hint) { - if (breadcrumb.category === "ui.click") { - const { target } = hint.event; - if (target.ariaLabel) { - breadcrumb.message = target.ariaLabel; - } - } - return breadcrumb; - }, -}); -``` - -For information about which hints are available see hints in JavaScript. diff --git a/platform-includes/configuration/before-send-hint/javascript.mdx b/platform-includes/configuration/before-send-hint/javascript.mdx deleted file mode 100644 index 7deecd94ad9a56..00000000000000 --- a/platform-includes/configuration/before-send-hint/javascript.mdx +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -Sentry.init({ - // ... - beforeSend(event, hint) { - const error = hint.originalException; - if ( - error && - error.message && - error.message.match(/database unavailable/i) - ) { - event.fingerprint = ["database-unavailable"]; - } - return event; - }, -}); -``` - -For information about which hints are available see hints in JavaScript. diff --git a/platform-includes/configuration/before-send-span/javascript.mdx b/platform-includes/configuration/before-send-span/javascript.mdx index dc14bc0cb3ab67..980af85371be71 100644 --- a/platform-includes/configuration/before-send-span/javascript.mdx +++ b/platform-includes/configuration/before-send-span/javascript.mdx @@ -1,10 +1,7 @@ ```javascript Sentry.init({ dsn: "___PUBLIC_DSN___", - - // Called for all spans beforeSendSpan(span) { - // Modify the span here if (span.description === "should be renamed") { span.description = "renamed span"; span.data = { diff --git a/platform-includes/configuration/before-send-transaction/javascript.mdx b/platform-includes/configuration/before-send-transaction/javascript.mdx index f67628ea5193c6..c1d1a05093a2c0 100644 --- a/platform-includes/configuration/before-send-transaction/javascript.mdx +++ b/platform-includes/configuration/before-send-transaction/javascript.mdx @@ -1,10 +1,7 @@ ```javascript Sentry.init({ dsn: "___PUBLIC_DSN___", - - // Called for transaction events beforeSendTransaction(event) { - // Modify or drop the event here if (event.transaction === "/unimportant/route") { // Don't send the event to Sentry return null; diff --git a/platform-includes/configuration/before-send/javascript.mdx b/platform-includes/configuration/before-send/javascript.mdx index 67b19baefe5703..ec13fedfa3f41f 100644 --- a/platform-includes/configuration/before-send/javascript.mdx +++ b/platform-includes/configuration/before-send/javascript.mdx @@ -1,15 +1,8 @@ -In JavaScript, you can use a function to modify the event or return a completely new one. -You can either return `null` or an event payload - no other return value (including `void`) is allowed. -If you return `null`, the event will be discarded. - ```javascript Sentry.init({ dsn: "___PUBLIC_DSN___", - - // Called for message and error events beforeSend(event) { - // Modify or drop the event here if (event.user) { // Don't send user's email address delete event.user.email;