sentry

package
v0.5.67 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureErr

func CaptureErr(err error, tags map[string]string)

CaptureErr sends an error to Sentry with optional string tags for context (e.g. round_id, share_index). No-op when Sentry is not initialized.

func FlushSentry

func FlushSentry()

FlushSentry drains buffered events before shutdown.

func InitSentry

func InitSentry(dsn, release, serverName string, logger log.Logger) error

InitSentry initializes the Sentry SDK with the given DSN. If dsn is empty, Sentry remains disabled and all capture calls become no-ops. The release string is attached to every event for deploy correlation (typically the binary version from ldflags). serverName identifies the specific node (e.g. the CometBFT moniker "val1") so events from different validators can be distinguished in the Sentry dashboard.

Types

type TraceSpan added in v0.5.36

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

TraceSpan is a small wrapper around a Sentry span that keeps callers from depending on sentry-go directly. Methods are safe to call when tracing is disabled.

func StartSpan added in v0.5.40

func StartSpan(ctx context.Context, operation, description string, tags map[string]string, data map[string]interface{}) (context.Context, *TraceSpan)

StartSpan starts a performance span when Sentry tracing is enabled. If ctx does not already contain a Sentry span, the span becomes the root transaction so background work is still sent to Sentry.

func StartTransaction added in v0.5.36

func StartTransaction(ctx context.Context, name string, tags map[string]string, data map[string]interface{}) (context.Context, *TraceSpan)

StartTransaction starts a root performance transaction when Sentry tracing is enabled. It returns the transaction context so child spans attach to it.

func (*TraceSpan) Finish added in v0.5.36

func (s *TraceSpan) Finish(err error)

Finish closes the span and marks it OK or failed based on err.

func (*TraceSpan) SetData added in v0.5.36

func (s *TraceSpan) SetData(name string, value interface{})

SetData attaches diagnostic data to a span.

Jump to

Keyboard shortcuts

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