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
15 changes: 15 additions & 0 deletions src/platform-includes/configuration/before-send-transaction/go.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
The `BeforeSendTransaction` hook is a function that can be passed to `sentry.Init` via the corresponding configuration option. In this function you can either update the transaction event before it's sent to Sentry, or drop it by returning `nil`, for example:

```go
sentry.Init(sentry.ClientOptions{
// ...
BeforeSendTransaction: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {
if event.Message == "test-transaction" {
// Don't send the transaction to Sentry
return nil
}
// Update the message for every sent transaction
event.Message += " [example]"
return event
},
```
2 changes: 1 addition & 1 deletion src/platforms/common/configuration/filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ 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"]}>
<PlatformSection supported={["node", "javascript", "php", "go"]} notSupported={["php.symfony"]}>

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

Expand Down
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"]} notSupported={["php.symfony"]}>
<ConfigKey name="before-send-transaction" supported={["javascript", "node", "php", "go"]} 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