From ef5e6c584979cbd18181c83f4a54302027e9a2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Thu, 11 Jul 2019 17:58:29 +0200 Subject: [PATCH 1/3] docs: sentry-go serverless usage and integrations removal --- __tests__/__snapshots__/documentation.js.snap | 1 + .../_documentation/platforms/go/config.md | 23 +++++++++ .../platforms/go/integrations.md | 2 +- .../_documentation/platforms/go/serverless.md | 49 +++++++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src/collections/_documentation/platforms/go/serverless.md 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..b66db3fd49b898 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 `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 + }, +}) +``` \ No newline at end of file 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..2930972a9f7b12 --- /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, in order 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 necessary source files with a 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 the source code is actually located 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 ourselves that the event is delivered to Sentrys severs. + +It can be achieved twofold, using `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. \ No newline at end of file From 9b8d5ceb9739b4d428bdd106f7d6f00d1b09de65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Thu, 11 Jul 2019 18:14:51 +0200 Subject: [PATCH 2/3] fix: Updated usage href link --- src/collections/_documentation/platforms/go/serverless.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collections/_documentation/platforms/go/serverless.md b/src/collections/_documentation/platforms/go/serverless.md index 2930972a9f7b12..e7a75eb8e90bdd 100644 --- a/src/collections/_documentation/platforms/go/serverless.md +++ b/src/collections/_documentation/platforms/go/serverless.md @@ -46,4 +46,4 @@ Most (if not all) serverless solutions won't wait for network responses before c Because of that, we need to make sure ourselves that the event is delivered to Sentrys severs. It can be achieved twofold, using `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. \ No newline at end of file +Both ways are described in the [Usage]({%- link _documentation/platforms/go/index.md -%}#usage) section of this documentation. \ No newline at end of file From 6568b8b85fde0ca2740376162dad8ffc33367a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Thu, 11 Jul 2019 22:13:44 +0200 Subject: [PATCH 3/3] Apply suggestions from code review Co-Authored-By: Tien "Mimi" Nguyen --- .../_documentation/platforms/go/config.md | 4 ++-- .../_documentation/platforms/go/serverless.md | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/collections/_documentation/platforms/go/config.md b/src/collections/_documentation/platforms/go/config.md index b66db3fd49b898..0879b27ea71711 100644 --- a/src/collections/_documentation/platforms/go/config.md +++ b/src/collections/_documentation/platforms/go/config.md @@ -95,7 +95,7 @@ sentry.Init(sentryClientOptions) 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 `Integrations` configuration option and filter unwanted integrations. For example: +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{ @@ -110,4 +110,4 @@ sentry.Init(sentry.ClientOptions{ return filteredIntegrations }, }) -``` \ No newline at end of file +``` diff --git a/src/collections/_documentation/platforms/go/serverless.md b/src/collections/_documentation/platforms/go/serverless.md index e7a75eb8e90bdd..cfab0b1964cde7 100644 --- a/src/collections/_documentation/platforms/go/serverless.md +++ b/src/collections/_documentation/platforms/go/serverless.md @@ -6,7 +6,7 @@ sidebar_order: 5 ### Source Context `sentry-go` SDK comes with the support for serverless solutions out of the box. -However, in order to get the source contexts right, you need to bundle your source code with the binary itself. +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: @@ -32,18 +32,18 @@ For example, when using __AWS Lambda__ and given this tree structure: ``` -You can build one of the binaries and bundle them with necessary source files with a command: +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 the source code is actually located on the deployed machine. Everything else should be done automatically by the SDK. +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 ourselves that the event is delivered to Sentrys severs. +Because of that, we need to make sure that the event is delivered to Sentry's severs. -It can be achieved twofold, using `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. \ No newline at end of file +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.