sentryx

package
v0.5.4 Latest Latest
Warning

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

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

Documentation

Overview

Package sentryx wraps github.com/getsentry/sentry-go with configuration from config so the rest of the service does not need to know about Sentry's surface area.

Role in architecture:

  • Infrastructure: initializes the global Sentry hub and provides Flush for shutdown.
  • Settings are loaded via config.GetConfig().Sentry (or config.Setup).

Responsibilities:

  • Init: configure DSN, environment, release, server name, sample rates, and stack traces.
  • LoadConfig: read SentryConfiguration from the global config package.
  • Flush: drain buffered events with a timeout (safe when Sentry was never initialized).

Constraints:

  • SENTRY_DSN empty is the explicit "Sentry is off" signal — Init is a no-op and returns false.
  • Init returns bool (enabled), not error; invalid DSN is logged and treated as off.
  • The service must keep running whether Sentry is on, off, or misconfigured.
  • Default server name is "app" when SENTRY_SERVER_NAME is empty.
  • Sample rates outside [0, 1] are clamped to safe defaults (1.0 errors, 0.0 traces).

This package must NOT:

  • Contain use-case or domain logic.
  • Fail process startup when Sentry cannot be enabled.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flush

func Flush(timeout time.Duration)

Flush drains any buffered events. Safe to call when Sentry was never initialised (returns immediately). Use defer sentryx.Flush(cfg.FlushTimeout) right after Init so SIGTERM doesn't drop the panic that caused the shutdown.

func Init

Init configures the global Sentry hub. Returning a boolean (enabled) instead of an error keeps the caller simple — when DSN is empty we report "off" and proceed silently, when DSN is set but invalid Sentry's own Init returns an error which we log and treat as "off" (the service must keep running either way).

func LoadConfig

func LoadConfig() config.SentryConfiguration

LoadConfig returns Sentry settings from the global config package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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