Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add Go Transports section #1071

Merged
merged 1 commit into from
Jun 19, 2019
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
1 change: 1 addition & 0 deletions __tests__/__snapshots__/documentation.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/collections/_documentation/platforms/go/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%})
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
58 changes: 58 additions & 0 deletions src/collections/_documentation/platforms/go/transports.md
Original file line number Diff line number Diff line change
@@ -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
}
```