Skip to content

Commit

Permalink
docs: Add Go Transports section
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Jun 19, 2019
1 parent 03795d4 commit ad1666f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
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
}
```

0 comments on commit ad1666f

Please sign in to comment.