sentry

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flush

func Flush(timeout time.Duration) bool

Flush the Sentry log, usually called before shutting down servers

func Init

func Init(conf Config) (err error)

Initialize the Sentry SDK with the configuration; must be called before servers are started

func StreamInterceptor added in v0.2.0

func StreamInterceptor(conf Config) grpc.StreamServerInterceptor

StreamInterceptor for gRPC services that are using Sentry. Ensures that Sentry is used in a thread-safe manner and that performance, panics, and errors are correctly tracked with gRPC method names. Streaming RPCs don't necessarily benefit from Sentry performance tracking, but it is helpful to see average durations.

func TrackPerformance

func TrackPerformance(tags map[string]string) gin.HandlerFunc

Gin middleware that tracks HTTP request performance with Sentry

func UnaryInterceptor added in v0.2.0

func UnaryInterceptor(conf Config) grpc.UnaryServerInterceptor

UnaryInterceptor for gRPC services that are using Sentry. Ensures that Sentry is used in a thread-safe manner and that performance, panics, and errors are correctly tracked with gRPC method names.

func UseTags

func UseTags(tags map[string]string) gin.HandlerFunc

Gin middleware that adds request-level tags to the Sentry scope.

Types

type Config

type Config struct {
	DSN              string  `split_words:"true"`
	ServerName       string  `split_words:"true"`
	Environment      string  `split_words:"true"`
	Release          string  `split_words:"true"`
	TrackPerformance bool    `split_words:"true" default:"false"`
	SampleRate       float64 `split_words:"true" default:"0.2"`
	ReportErrors     bool    `split_words:"true" default:"false"`
	Repanic          bool    `ignored:"true"`
	Debug            bool    `default:"false"`
}

Sentry configuration for use in application-configuration

func (Config) ClientOptions

func (c Config) ClientOptions() sentry.ClientOptions

func (Config) GetRelease

func (c Config) GetRelease() string

func (Config) UsePerformanceTracking

func (c Config) UsePerformanceTracking() bool

Performance tracking is enabled if Sentry is enabled and track performance is explicitly set

func (Config) UseSentry

func (c Config) UseSentry() bool

Returns true if Sentry is enabled (e.g. a DSN is configured)

func (Config) Validate

func (c Config) Validate() error

Jump to

Keyboard shortcuts

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