http

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTransportQueueFull = errors.New("transport queue full")
	ErrTransportClosed    = errors.New("transport is closed")
	ErrEmptyEnvelope      = errors.New("empty envelope provided")
)

Functions

func NewAsyncTransport

func NewAsyncTransport(options TransportOptions) protocol.TelemetryTransport

func NewSyncTransport

func NewSyncTransport(options TransportOptions) protocol.TelemetryTransport

Types

type AsyncTransport

type AsyncTransport struct {
	QueueSize int
	Timeout   time.Duration
	// contains filtered or unexported fields
}

AsyncTransport is the default, non-blocking, implementation of Transport.

Clients using this transport will enqueue requests in a queue and return to the caller before any network communication has happened. Requests are sent to Sentry sequentially from a background goroutine.

func (*AsyncTransport) Close

func (t *AsyncTransport) Close()

func (*AsyncTransport) Flush

func (t *AsyncTransport) Flush(timeout time.Duration) bool

func (*AsyncTransport) FlushWithContext

func (t *AsyncTransport) FlushWithContext(ctx context.Context) bool

func (*AsyncTransport) HasCapacity added in v0.38.0

func (t *AsyncTransport) HasCapacity() bool

HasCapacity reports whether the async transport queue appears to have space for at least one more envelope. This is a best-effort, non-blocking check.

func (*AsyncTransport) IsRateLimited

func (t *AsyncTransport) IsRateLimited(category ratelimit.Category) bool

func (*AsyncTransport) SendEnvelope

func (t *AsyncTransport) SendEnvelope(envelope *protocol.Envelope) error

type NoopTransport

type NoopTransport struct{}

NoopTransport is a transport implementation that drops all events. Used internally when an empty or invalid DSN is provided.

func NewNoopTransport

func NewNoopTransport() *NoopTransport

func (*NoopTransport) Close

func (t *NoopTransport) Close()

func (*NoopTransport) Flush

func (t *NoopTransport) Flush(_ time.Duration) bool

func (*NoopTransport) FlushWithContext

func (t *NoopTransport) FlushWithContext(_ context.Context) bool

func (*NoopTransport) HasCapacity added in v0.38.0

func (t *NoopTransport) HasCapacity() bool

func (*NoopTransport) IsRateLimited

func (t *NoopTransport) IsRateLimited(_ ratelimit.Category) bool

func (*NoopTransport) SendEnvelope

func (t *NoopTransport) SendEnvelope(_ *protocol.Envelope) error

type SyncTransport

type SyncTransport struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

SyncTransport 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 AsyncTransport.

func (*SyncTransport) Close

func (t *SyncTransport) Close()

func (*SyncTransport) Flush

func (t *SyncTransport) Flush(_ time.Duration) bool

func (*SyncTransport) FlushWithContext

func (t *SyncTransport) FlushWithContext(_ context.Context) bool

func (*SyncTransport) HasCapacity added in v0.38.0

func (t *SyncTransport) HasCapacity() bool

func (*SyncTransport) IsRateLimited

func (t *SyncTransport) IsRateLimited(category ratelimit.Category) bool

func (*SyncTransport) SendEnvelope

func (t *SyncTransport) SendEnvelope(envelope *protocol.Envelope) error

func (*SyncTransport) SendEnvelopeWithContext

func (t *SyncTransport) SendEnvelopeWithContext(ctx context.Context, envelope *protocol.Envelope) error

type TransportOptions

type TransportOptions struct {
	Dsn           string
	HTTPClient    *http.Client
	HTTPTransport http.RoundTripper
	HTTPProxy     string
	HTTPSProxy    string
	CaCerts       *x509.CertPool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL