Documentation
¶
Overview ¶
Package telemetry connects the shared Go runtime to Sentry. Instrumentation is a no-op without a DSN and never depends on Sentry being reachable.
Index ¶
- Constants
- func Breadcrumb(ctx context.Context, category, message string, data map[string]any)
- func Capture(ctx context.Context, err error) *sentry.EventID
- func Count(ctx context.Context, name string, n int64, opts ...MetricOption)
- func Duration(ctx context.Context, name string, elapsed time.Duration, opts ...MetricOption)
- func Enabled() bool
- func FinishSpan(span *sentry.Span, err error)
- func Flush() bool
- func Gauge(ctx context.Context, name string, value float64, opts ...MetricOption)
- func HTTP(surface string, next http.Handler) http.Handler
- func NormalizeSQL(query string) string
- func Observe(ctx context.Context, name string, elapsed time.Duration, err error, ...)
- func Recording(ctx context.Context) bool
- func RecoverAndRepanic(ctx context.Context)
- func RegisterCollector(name string, collector func(context.Context)) func()
- func SetRoute(ctx context.Context, method, pattern string)
- func StartSpan(ctx context.Context, operation, description string) (context.Context, *sentry.Span)
- func Transport(service string, base http.RoundTripper) http.RoundTripper
- type LogHook
- type LogWriter
- type MetricOption
- type Options
- type Runtime
- type Task
- type TraceCarrier
Constants ¶
const FlushTimeout = 2 * time.Second
Variables ¶
This section is empty.
Functions ¶
func Breadcrumb ¶
func FinishSpan ¶
func NormalizeSQL ¶
NormalizeSQL preserves the query shape, never bind arguments or literals. This also handles SQL/Cypher comments and PostgreSQL dollar-quoted bodies.
func RecoverAndRepanic ¶
RecoverAndRepanic preserves the original crash behavior after delivery.
func RegisterCollector ¶
RegisterCollector installs cheap runtime gauges. A returned cleanup removes the collector when a pool, cache or queue consumer is stopped.
func Transport ¶
func Transport(service string, base http.RoundTripper) http.RoundTripper
Transport instruments outbound calls without forwarding cookies, bodies, auth headers, query strings, or trace headers to unrelated external services.
Types ¶
type LogHook ¶
type LogHook struct{}
LogHook carries event context through zerolog's JSON writer without keeping a global map of requests or leaking one goroutine's scope into another.
type MetricOption ¶
type MetricOption struct {
// contains filtered or unexported fields
}
func Attributes ¶
func Attributes(values ...string) MetricOption
func WithUnit ¶
func WithUnit(unit string) MetricOption
type Task ¶
func StartTask ¶
func StartTask(ctx context.Context, operation, name string, attrs ...string) (context.Context, *Task)
StartTask gives concurrent workers separate hubs, breadcrumbs and scopes.
func StartTaskWithTrace ¶
type TraceCarrier ¶
func Propagation ¶
func Propagation(ctx context.Context) TraceCarrier