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 ¶
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 ¶
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 ¶
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.