Skip to content

Commit

Permalink
docs(transports): More details on Transport implementations (#344)
Browse files Browse the repository at this point in the history
Shedding some light on how the two transports differ and when you'd want to use one over the other.
  • Loading branch information
rhcarvalho authored May 17, 2021
1 parent 2524861 commit 0255e3d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ type batch struct {
done chan struct{} // closed to signal completion of all items
}

// HTTPTransport is a default implementation of Transport interface used by Client.
// HTTPTransport is the default, non-blocking, implementation of Transport.
//
// Clients using this transport will enqueue requests in a buffer and return to
// the caller before any network communication has happened. Requests are sent
// to Sentry sequentially from a background goroutine.
type HTTPTransport struct {
dsn *Dsn
client *http.Client
Expand Down Expand Up @@ -410,7 +414,17 @@ func (t *HTTPTransport) worker() {
// HTTPSyncTransport
// ================================

// HTTPSyncTransport is an implementation of Transport interface which blocks after each captured event.
// HTTPSyncTransport is a blocking implementation of Transport.
//
// Clients using this transport will send requests to Sentry sequentially and
// block until a response is returned.
//
// The blocking behavior is useful in a limited set of use cases. For example,
// use it when deploying code to a Function as a Service ("Serverless")
// platform, where any work happening in a background goroutine is not
// guaranteed to execute.
//
// For most cases, prefer HTTPTransport.
type HTTPSyncTransport struct {
dsn *Dsn
client *http.Client
Expand Down

0 comments on commit 0255e3d

Please sign in to comment.