observability

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package observability provides error tracking, breadcrumbs, and monitoring for BubblyUI.

The observability package enables comprehensive error tracking and debugging capabilities for BubblyUI applications. It provides a pluggable error reporting system, breadcrumb trails for debugging, and integration with popular error tracking services like Sentry.

This package is an alias for github.com/newbpydev/bubblyui/pkg/bubbly/observability, providing a cleaner import path for users.

Error Reporting

  • ConsoleReporter: Logs errors to stdout (development)
  • SentryReporter: Sends errors to Sentry (production)
  • Custom implementations: Implement ErrorReporter for other services

Breadcrumbs

Breadcrumbs provide a trail of events leading up to an error:

observability.RecordBreadcrumb("navigation", "User navigated to /users", map[string]interface{}{
    "path": "/users",
})

Example

import "github.com/newbpydev/bubblyui/observability"

// Development: Use console reporter
reporter := observability.NewConsoleReporter(true)
observability.SetErrorReporter(reporter)

// Production: Use Sentry
reporter, err := observability.NewSentryReporter(os.Getenv("SENTRY_DSN"),
    observability.WithEnvironment("production"),
    observability.WithRelease("v1.0.0"),
)
if err != nil {
    log.Fatal(err)
}
observability.SetErrorReporter(reporter)
defer reporter.Flush(5 * time.Second)

Index

Constants

View Source
const MaxBreadcrumbs = observability.MaxBreadcrumbs

MaxBreadcrumbs is the maximum number of breadcrumbs stored.

Variables

View Source
var ClearBreadcrumbs = observability.ClearBreadcrumbs

ClearBreadcrumbs removes all recorded breadcrumbs.

GetBreadcrumbs returns all recorded breadcrumbs.

View Source
var GetErrorReporter = observability.GetErrorReporter

GetErrorReporter returns the current global error reporter.

View Source
var NewConsoleReporter = observability.NewConsoleReporter

NewConsoleReporter creates a new console reporter. Set verbose to true for detailed output.

View Source
var RecordBreadcrumb = observability.RecordBreadcrumb

RecordBreadcrumb adds a breadcrumb to the trail.

View Source
var SetErrorReporter = observability.SetErrorReporter

SetErrorReporter sets the global error reporter.

WithDebug enables Sentry debug mode.

View Source
var WithEnvironment = observability.WithEnvironment

WithEnvironment sets the Sentry environment tag.

WithRelease sets the Sentry release version.

Functions

This section is empty.

Types

type Breadcrumb = observability.Breadcrumb

Breadcrumb represents a single breadcrumb trail entry.

type CommandGenerationError

type CommandGenerationError = observability.CommandGenerationError

CommandGenerationError wraps panics during automatic command generation.

type ConsoleReporter

type ConsoleReporter = observability.ConsoleReporter

ConsoleReporter logs errors to stdout for development.

type ErrorContext

type ErrorContext = observability.ErrorContext

ErrorContext provides contextual information for error reports.

type ErrorReporter

type ErrorReporter = observability.ErrorReporter

ErrorReporter defines the interface for error reporting implementations.

type HandlerPanicError

type HandlerPanicError = observability.HandlerPanicError

HandlerPanicError wraps panics that occur in event handlers.

type SentryOption

type SentryOption = observability.SentryOption

SentryOption configures the Sentry reporter.

func WithBeforeSend

func WithBeforeSend(fn func(*sentry.Event, *sentry.EventHint) *sentry.Event) SentryOption

WithBeforeSend sets a callback to modify events before sending.

type SentryReporter

type SentryReporter = observability.SentryReporter

SentryReporter sends errors to Sentry for production monitoring.

func NewSentryReporter

func NewSentryReporter(dsn string, opts ...SentryOption) (*SentryReporter, error)

NewSentryReporter creates a new Sentry reporter with the given DSN.

Jump to

Keyboard shortcuts

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