Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/platforms/common/configuration/filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ All Sentry SDKs support the <PlatformIdentifier name="before-send" /> callback m

<PlatformContent includePath="configuration/before-send" />

<PlatformSection supported={["javascript", "node"]}>

<PlatformContent includePath="configuration/before-send-transaction" />

</PlatformSection>

Note also that breadcrumbs can be filtered, as discussed in [our Breadcrumbs documentation](/product/error-monitoring/breadcrumbs/).

<PlatformSection notSupported={["apple", "dotnet", "elixir", "rust"]}>
Expand Down Expand Up @@ -91,16 +85,28 @@ In this example, the fingerprint is forced to a common value if an exception of

<PlatformSection supported={["node", "javascript", "python", "php", "dotnet", "java", "ruby", "go", "react-native", "android", "dart"]} notSupported={["javascript.cordova"]}>

## Using Sampling to Filter Transaction Events
## Filtering Transaction Events

To prevent certain transactions from being reported to Sentry, use the <PlatformIdentifier name="traces-sampler" /> or <PlatformIdentifier name="before-send-transaction" /> configuration option, which allows you to provide a function to evaluate the current transaction and drop it if it's not one you want.

To prevent certain transactions from being reported to Sentry, use the <PlatformIdentifier name="traces-sampler" /> configuration option, which allows you to provide a function to evaluate the current transaction and drop it if it's not one you want. (It also allows you to sample different transactions at different rates.)
### Using <PlatformIdentifier name="traces-sampler" />

**Note:** The <PlatformIdentifier name="traces-sampler" /> and <PlatformIdentifier name="traces-sample-rate" /> config options are mutually exclusive. If you define a <PlatformIdentifier name="traces-sampler" /> 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.

In its simplest form, used just for filtering the transaction, it looks like this:

<PlatformContent includePath="performance/traces-sampler-as-filter" />

It also allows you to sample different transactions at different rates.

Learn more about <PlatformLink to="/configuration/sampling/">configuring the sample rate</PlatformLink>.

<PlatformSection supported={["node", "javascript", "php"]} notSupported={["php.symfony"]}>

### Using <PlatformIdentifier name="before-send-transaction" />

<PlatformContent includePath="configuration/before-send-transaction" />

</PlatformSection>

</PlatformSection>
2 changes: 1 addition & 1 deletion src/platforms/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ This function is called with an SDK-specific message or error event object, and

</ConfigKey>

<ConfigKey name="before-send-transaction" supported={["javascript", "node", "php"]}>
<ConfigKey name="before-send-transaction" supported={["javascript", "node", "php"]} notSupported={["php.symfony"]}>

This function is called with an SDK-specific transaction event object, and can return a modified transaction event object, or `null` to skip reporting the event. One way this might be used is for manual PII stripping before sending.

Expand Down