sentry

package
v1.96.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sentry has a client with additional functionality and helpers to complement the official one.

Index

Constants

View Source
const (
	// LevelCritical is a critical breadcrumb.
	LevelFatal = sentry.LevelFatal

	// LevelWarning is a warning breadcrumb.
	LevelWarning = sentry.LevelWarning

	// LevelError is an error breadcrumb.
	LevelError = sentry.LevelError

	// LevelInfo is an info breadcrumb.
	LevelInfo = sentry.LevelInfo

	// LevelDebug is a debug breadcrumb.
	LevelDebug = sentry.LevelDebug
)

Variables

This section is empty.

Functions

func LogBreadcrumb

func LogBreadcrumb(ctx context.Context, level sentry.Level, category, message string)

LogBreadcrumb logs a new breadcrumb in the Sentry instance of the context.

func WithContext

func WithContext(ctx context.Context) context.Context

WithContext stores a new instance of Sentry in the context and returns the new generated context that you should use everywhere.

func WithContextRPC

func WithContextRPC(ctx context.Context, rpcService, rpcMethod string) context.Context

WithContextRPC stores a new instance of Sentry in the context and returns the new generated context that you should use everywhere annotating it with the RPC service name and RPC method name. Used mostly for GRPC calls.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps a Sentry connection.

func NewClient

func NewClient(dsn string) *Client

NewClient opens a new connection to the Sentry report API.

func (*Client) Report added in v1.17.0

func (client *Client) Report(ctx context.Context, appErr error)

Report reports an error to Sentry.

func (*Client) ReportPanic added in v1.72.1

func (client *Client) ReportPanic(ctx context.Context, panicErr interface{})

ReportPanic sends a panic correctly formated to the server if the argument is not nil.

func (*Client) ReportPanics added in v1.17.0

func (client *Client) ReportPanics(ctx context.Context)

ReportPanics detects panics in the rest of the body of the function and reports it if one occurs.

func (*Client) ReportPanicsRequest added in v1.17.0

func (client *Client) ReportPanicsRequest(r *http.Request)

ReportPanicsRequest detects pancis in the body of the function and reports them linked to a HTTP request.

func (*Client) ReportRequest

func (client *Client) ReportRequest(r *http.Request, appErr error)

ReportRequest reports an error linked to a HTTP request.

type Sentry

type Sentry struct {
	// contains filtered or unexported fields
}

Sentry accumulates info through out the whole request to send them in case an error is reported.

func FromContext

func FromContext(ctx context.Context) *Sentry

FromContext returns the Sentry instance stored in the context. If no instance was created it will return nil.

Jump to

Keyboard shortcuts

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