Documentation
¶
Overview ¶
Package executor instruments arbitrary execution functions of the form func(context.Context, Req) (Res, error) with traces, metrics, and optional slog logging.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wrap ¶
func Wrap[Req, Res any]( provider *metry.Provider, operationName string, next func(context.Context, Req) (Res, error), opts ...Option, ) func(context.Context, Req) (Res, error)
Wrap returns a function that runs next with a span, standard executor metrics, and optional slog logs. Metrics use meter name "metry.executor" and instrument names executor.operation.duration / executor.operation.calls with attributes operation (the operationName) and status (success, error, or panic).
Types ¶
type Option ¶
type Option func(*config)
Option configures Wrap.
func WithLogError ¶
WithLogError enables Error logs when next returns an error or panics (requires WithLogger). Default is true.
func WithLogStart ¶
WithLogStart enables an Info log at the beginning of each invocation (requires WithLogger).
func WithLogger ¶
WithLogger sets the slog logger used for optional start and error/panic logs.