sentry

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package sentry provides Sentry error tracking and distributed tracing for the ToolHive API server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureException

func CaptureException(r *http.Request, err error)

CaptureException reports an error to Sentry using the hub from the request context. Falls back to the current hub if no hub is attached to the context. No-op when Sentry is not initialized.

The API server's error handler calls this alongside span.RecordError so that 5xx errors appear as both OTEL span errors (distributed tracing) and standalone Sentry Issues (error tracking). The Sentry span processor only creates transactions; explicit hub calls are required for Issues.

func Close

func Close()

Close flushes buffered Sentry events and shuts down the SDK. Safe to call even when Sentry was not initialized.

func Enabled

func Enabled() bool

Enabled reports whether the Sentry SDK was successfully initialized.

func Init

func Init(cfg Config) error

Init initializes the Sentry SDK with the given configuration. If the DSN is empty, initialization is skipped and all Sentry operations become no-ops.

func RecoverPanic

func RecoverPanic(r *http.Request, recovered interface{})

RecoverPanic reports a recovered panic value to Sentry. No-op when Sentry is not initialized.

Types

type Config

type Config struct {
	// DSN is the Sentry Data Source Name. When empty, Sentry is disabled.
	DSN string
	// Environment identifies the deployment environment (e.g. "production", "development").
	Environment string
	// TracesSampleRate controls the percentage of transactions captured for
	// performance monitoring (0.0–1.0).
	TracesSampleRate float64
	// Debug enables Sentry SDK debug logging.
	Debug bool
}

Config holds the configuration for Sentry integration.

Jump to

Keyboard shortcuts

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