From 6dcc751b909541916d487158ac08b6469b744467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Wed, 19 Jun 2019 14:21:05 +0200 Subject: [PATCH] docs: Add Go Transports section --- __tests__/__snapshots__/documentation.js.snap | 1 + .../_documentation/platforms/go/index.md | 1 + .../platforms/go/integrations.md | 2 +- .../_documentation/platforms/go/transports.md | 58 +++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/collections/_documentation/platforms/go/transports.md diff --git a/__tests__/__snapshots__/documentation.js.snap b/__tests__/__snapshots__/documentation.js.snap index 422b19b312b93..c4e0d683b52b1 100644 --- a/__tests__/__snapshots__/documentation.js.snap +++ b/__tests__/__snapshots__/documentation.js.snap @@ -283,6 +283,7 @@ Array [ "platforms/go/martini/index.html", "platforms/go/migration/index.html", "platforms/go/negroni/index.html", + "platforms/go/transports/index.html", "platforms/index.html", "platforms/javascript/advance-settings/index.html", "platforms/javascript/angular/index.html", diff --git a/src/collections/_documentation/platforms/go/index.md b/src/collections/_documentation/platforms/go/index.md index f116ce2f67f40..a4f3ba329ba0d 100644 --- a/src/collections/_documentation/platforms/go/index.md +++ b/src/collections/_documentation/platforms/go/index.md @@ -76,6 +76,7 @@ For more detailed information about how to get the most out of `sentry-go` there - [Configuration]({%- link _documentation/platforms/go/config.md -%}) - [Error Reporting]({%- link _documentation/error-reporting/quickstart.md -%}?platform={{ include.platform }}) - [Enriching Error Data]({%- link _documentation/enriching-error-data/context.md -%}?platform={{ include.platform }}) +- [Transports]({%- link _documentation/platforms/go/transports.md -%}) - [Integrations]({%- link _documentation/platforms/go/integrations.md -%}) - [net/http]({%- link _documentation/platforms/go/http.md -%}) - [echo]({%- link _documentation/platforms/go/echo.md -%}) diff --git a/src/collections/_documentation/platforms/go/integrations.md b/src/collections/_documentation/platforms/go/integrations.md index 29a36eed800b6..776f0d11db555 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: 3 +sidebar_order: 4 --- 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/transports.md b/src/collections/_documentation/platforms/go/transports.md new file mode 100644 index 0000000000000..3719dbbe31e60 --- /dev/null +++ b/src/collections/_documentation/platforms/go/transports.md @@ -0,0 +1,58 @@ +--- +title: Transports +sidebar_order: 3 +--- + +Transports let you change the way, in which events are delivered to Sentry. + +The Sentry Go SDK itself, provides two built-in transports. `HTTPTransport`, which is non-blocking and is used by default. And `HTTPSyncTransport` which is blocking. Each transport, provide slightly different configuration options. + +## Usage + +To configure transport, provide an instance of `sentry.Transport` interface to `ClientOptions` + +```go +package main + +import ( + "time" + + "github.com/getsentry/sentry-go" +) + +func main() { + sentrySyncTransport := sentry.NewHTTPSyncTransport() + sentrySyncTransport.Timeout = time.Second * 3 + + sentry.Init(sentry.ClientOptions{ + Dsn: "___DSN___", + Transport: sentrySyncTransport, + }) +} +``` + +Each transport, provide it's own factory function. `NewHTTPTransport` and `NewHTTPSyncTransport` respectively. + +## Options + +## HTTPTransport + +```go +// HTTPTransport is a default implementation of `Transport` interface used by `Client`. +type HTTPTransport struct { + // Size of the transport buffer. Defaults to 30. + BufferSize int + // HTTP Client request timeout. Defaults to 30 seconds. + Timeout time.Duration +} +``` + +## HTTPSyncTransport + +```go +// HTTPSyncTransport is an implementation of `Transport` interface which blocks after each captured event. +type HTTPSyncTransport struct { + // HTTP Client request timeout. Defaults to 30 seconds. + Timeout time.Duration +} +``` \ No newline at end of file