Documentation
¶
Index ¶
- type Option
- type SentryWrapper
- func (sw *SentryWrapper) AddBreadcrumb(ctx context.Context, breadcrumb *sentry.Breadcrumb)
- func (sw *SentryWrapper) CaptureException(ctx context.Context, err error, tags map[string]string) *sentry.EventID
- func (sw *SentryWrapper) CaptureMessage(ctx context.Context, message string, tags map[string]string) *sentry.EventID
- func (sw *SentryWrapper) Flush(timeout time.Duration) bool
- func (sw *SentryWrapper) GetClient() *sentry.Client
- func (sw *SentryWrapper) Recover(recoveredError interface{})
- func (sw *SentryWrapper) SetTag(ctx context.Context, key, value string)
- func (sw *SentryWrapper) SetTags(ctx context.Context, tags map[string]string)
- func (sw *SentryWrapper) SetUser(ctx context.Context, user sentry.User)
- func (sw *SentryWrapper) WithContext(ctx context.Context) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*sentry.ClientOptions)
func WithEnvironment ¶
func WithMaxBreadcrumbs ¶
func WithRelease ¶
func WithSampleRate ¶
func WithTracesSampleRate ¶
type SentryWrapper ¶
type SentryWrapper struct {
// contains filtered or unexported fields
}
SentryWrapper is a wrapper around the Sentry client to simplify error reporting and context management.
func New ¶
func New(dsn string, opts ...Option) (*SentryWrapper, error)
New initializes and returns a SentryWrapper with the provided DSN and options.
func (*SentryWrapper) AddBreadcrumb ¶
func (sw *SentryWrapper) AddBreadcrumb(ctx context.Context, breadcrumb *sentry.Breadcrumb)
AddBreadcrumb adds a breadcrumb to the Sentry scope within the provided context.
func (*SentryWrapper) CaptureException ¶
func (sw *SentryWrapper) CaptureException(ctx context.Context, err error, tags map[string]string) *sentry.EventID
CaptureException reports an error to Sentry using the Sentry hub within the provided context.
func (*SentryWrapper) CaptureMessage ¶
func (sw *SentryWrapper) CaptureMessage(ctx context.Context, message string, tags map[string]string) *sentry.EventID
CaptureMessage sends a message to Sentry using the Sentry hub within the provided context.
func (*SentryWrapper) Flush ¶
func (sw *SentryWrapper) Flush(timeout time.Duration) bool
Flush waits for all buffered events to be sent to Sentry, blocking up to the given timeout duration.
func (*SentryWrapper) GetClient ¶
func (sw *SentryWrapper) GetClient() *sentry.Client
GetClient retrieves the underlying Sentry client.
func (*SentryWrapper) Recover ¶
func (sw *SentryWrapper) Recover(recoveredError interface{})
Recover captures and logs a panic, ensuring it is reported to Sentry before re-panicking.
func (*SentryWrapper) SetTag ¶
func (sw *SentryWrapper) SetTag(ctx context.Context, key, value string)
SetTag sets a key-value pair tag on the Sentry scope within the provided context.
func (*SentryWrapper) SetTags ¶
func (sw *SentryWrapper) SetTags(ctx context.Context, tags map[string]string)
SetTags sets multiple key-value pair tags on the Sentry scope within the provided context.
func (*SentryWrapper) SetUser ¶
func (sw *SentryWrapper) SetUser(ctx context.Context, user sentry.User)
SetUser assigns the current user to the Sentry scope within the provided context.
func (*SentryWrapper) WithContext ¶
func (sw *SentryWrapper) WithContext(ctx context.Context) context.Context
WithContext returns a new context with a Sentry hub bound to it.