sentryx

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sentryx is a thin wrapper over github.com/getsentry/sentry-go that centralizes initialization, silent no-op when SENTRY_DSN is not set, capture of whatsmeow errors (via zap hook) and the Gin middleware.

Without a configured DSN, all functions become no-ops — there is no overhead and no network call is made.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureError

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

CaptureError sends an error with optional tags.

func CaptureErrorWithFingerprint

func CaptureErrorWithFingerprint(err error, tags map[string]string, fingerprint []string)

CaptureErrorWithFingerprint sends an error with an explicit grouping key. Use it when the message carries identifiers (phone, JID, IDs) that would otherwise open a new issue per occurrence instead of incrementing one.

func CaptureMessage

func CaptureMessage(msg string, level sentry.Level, tags map[string]string)

CaptureMessage sends a message with a level.

func CaptureMessageWithFingerprint

func CaptureMessageWithFingerprint(msg string, level sentry.Level, tags map[string]string, fingerprint []string)

CaptureMessageWithFingerprint sends a message with an explicit grouping key. Use it when the text carries identifiers (IDs, JIDs) that would otherwise open a new issue per occurrence instead of incrementing one.

func Fingerprint

func Fingerprint(scope, msg string) []string

Fingerprint builds a stable Sentry grouping key for messages carrying identifiers. These errors interpolate message IDs, JIDs and phone numbers into the text, so using it as the issue title splits one recurring failure into hundreds of one-off issues. Groups by scope plus the message skeleton, with identifier-looking tokens replaced by a placeholder.

func Flush

func Flush(timeout time.Duration)

Flush blocks until pending events are sent or the timeout elapses.

func Init

func Init(cfg Config) error

Init initializes Sentry when a DSN is configured. Without a DSN it is a silent no-op. Init errors are only reported by the caller (log) — they do not bring down the process.

func IsEnabled

func IsEnabled() bool

IsEnabled reports whether Sentry was initialized with a valid DSN.

func IsExpectedNoise

func IsExpectedNoise(msg string) bool

IsExpectedNoise reports whether the message is a known self-recovering failure.

func Recover

func Recover()

Recover must be called via defer in critical goroutines to report panics to Sentry and re-throw them to preserve the original behavior.

func RecoverWithContext

func RecoverWithContext(ctx context.Context)

RecoverWithContext is like Recover, with scope derived from ctx.

Types

type Config

type Config struct {
	DSN              string
	Environment      string
	Release          string
	SampleRate       float64
	TracesSampleRate float64
	ServerName       string
}

Config is the subset we consume from internal/config.SentryConfig — duplicated as a plain struct to avoid an import cycle.

Jump to

Keyboard shortcuts

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