diff --git a/__tests__/__snapshots__/documentation.js.snap b/__tests__/__snapshots__/documentation.js.snap index 8bb63a2d4812a8..a7d8e990391da2 100644 --- a/__tests__/__snapshots__/documentation.js.snap +++ b/__tests__/__snapshots__/documentation.js.snap @@ -285,6 +285,7 @@ Array [ "platforms/go/martini/index.html", "platforms/go/migration/index.html", "platforms/go/negroni/index.html", + "platforms/go/serverless/index.html", "platforms/go/transports/index.html", "platforms/index.html", "platforms/javascript/advance-settings/index.html", diff --git a/src/collections/_documentation/platforms/go/config.md b/src/collections/_documentation/platforms/go/config.md index 3dcace9cc81739..0879b27ea71711 100644 --- a/src/collections/_documentation/platforms/go/config.md +++ b/src/collections/_documentation/platforms/go/config.md @@ -88,3 +88,26 @@ if err != nil { sentry.Init(sentryClientOptions) ``` + +### Removing Default Integrations + +`sentry-go` SDK has few built-in integrations that enhance events with additional information, or manage them in one way or another. + +If you want to read more about them, see the [source code](https://github.com/getsentry/sentry-go/blob/master/integrations.go) directly. + +However, there are some cases where you may want to disable some of them. To do this, you can use the `Integrations` configuration option and filter unwanted integrations. For example: + +```go +sentry.Init(sentry.ClientOptions{ + Integrations: func(integrations []sentry.Integration) []sentry.Integration { + var filteredIntegrations []sentry.Integration + for _, integration := range integrations { + if integration.Name() == "ContextifyFrames" { + continue + } + filteredIntegrations = append(filteredIntegrations, integration) + } + return filteredIntegrations + }, +}) +``` diff --git a/src/collections/_documentation/platforms/go/integrations.md b/src/collections/_documentation/platforms/go/integrations.md index 1dc2a1a00a8fdc..6c7f8bbca4b6d5 100644 --- a/src/collections/_documentation/platforms/go/integrations.md +++ b/src/collections/_documentation/platforms/go/integrations.md @@ -1,6 +1,6 @@ --- title: Integrations -sidebar_order: 5 +sidebar_order: 6 --- The sentry-go package currently comes with an integration for the native `net/http` package, `echo`, `gin`, `iris`, `martini` and `negroni` to make it easy to handle common scenarios. diff --git a/src/collections/_documentation/platforms/go/serverless.md b/src/collections/_documentation/platforms/go/serverless.md new file mode 100644 index 00000000000000..cfab0b1964cde7 --- /dev/null +++ b/src/collections/_documentation/platforms/go/serverless.md @@ -0,0 +1,49 @@ +--- +title: Serverless +sidebar_order: 5 +--- + +### Source Context + +`sentry-go` SDK comes with the support for serverless solutions out of the box. +However, to get the source contexts right, you need to bundle your source code with the binary itself. + +For example, when using __AWS Lambda__ and given this tree structure: + +```bash +. +├── bin +│   └── upload-image +│   └── process-image +│   └── create-thumbnails +├── functions +│   └── upload-image +│   └── main.go +│   └── process-image +│   └── main.go +│   └── create-thumbnails +│   └── main.go +├── helper +│   ├── foo.go +│   └── bar.go +├── util +│   ├── baz.go +│   └── qux.go + +``` + +You can build one of the binaries and bundle them with the necessary source files with this command: + +```bash +$ GOOS=linux go build -o bin/upload-image functions/upload-image/main.go && zip -r handler.zip bin/upload-image functions/upload-image/ helper/ util/ +``` + +The only requirement is that you locate the source code on the deployed machine. Everything else should be done automatically by the SDK. + +### Events Delivery + +Most (if not all) serverless solutions won't wait for network responses before closing the process. +Because of that, we need to make sure that the event is delivered to Sentry's severs. + +It can be achieved twofold, using the `sentry.Flush` method or by swapping the transport to `HTTPSyncTransport`. +Both ways are described in the [Usage]({%- link _documentation/platforms/go/index.md -%}#usage) section of this documentation.