Documentation
¶
Index ¶
- func InitSentry(_ context.Context, serviceName, version string) (func(context.Context) error, bool, error)
- func InitTelemetry(ctx context.Context, serviceName, version string) (func(context.Context) error, error)
- func NewSentryHTTPHandler() func(http.Handler) http.Handler
- func NewSentrySlogHandler(ctx context.Context) slog.Handler
- func RecordRefreshTokenGrant(ctx context.Context, outcome, reason string)
- func Start(ctx context.Context, name string) (context.Context, trace.Span)
- type Metrics
- type OTelHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitSentry ¶ added in v0.4.0
func InitSentry(_ context.Context, serviceName, version string) (func(context.Context) error, bool, error)
InitSentry initializes Sentry when SENTRY_DSN is set.
func InitTelemetry ¶
func InitTelemetry(ctx context.Context, serviceName, version string) (func(context.Context) error, error)
InitTelemetry initializes OpenTelemetry with OTLP exporters for metrics and traces. Configuration is read from environment variables:
- OTEL_EXPORTER_OTLP_ENDPOINT: The OTLP endpoint (e.g., https://api.honeycomb.io)
- OTEL_EXPORTER_OTLP_HEADERS: Headers for authentication (e.g., x-honeycomb-team=API_KEY)
- OTEL_SERVICE_NAME: Service name override (defaults to serviceName parameter)
Returns a shutdown function that must be called on graceful shutdown. If OTEL_EXPORTER_OTLP_ENDPOINT is not set, returns a no-op immediately. If a provider fails to initialize, telemetry continues without it.
func NewSentryHTTPHandler ¶ added in v0.4.0
func NewSentrySlogHandler ¶ added in v0.4.0
func RecordRefreshTokenGrant ¶ added in v0.4.0
Types ¶
type Metrics ¶
type Metrics struct{}
Metrics holds OpenTelemetry metric instruments. Populated when instruments are added.
type OTelHandler ¶
OTelHandler wraps a slog.Handler and mirrors each log record as a span event on the active trace span. Only fires when the span is recording, so there is no overhead when tracing is disabled or no span is in context. Use InfoContext/ErrorContext (not Info/Error) so the span can be reached.
func NewOTelHandler ¶
func NewOTelHandler(inner slog.Handler) *OTelHandler