executor

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 13 Imported by: 0

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

func WithLogError(v bool) Option

WithLogError enables Error logs when next returns an error or panics (requires WithLogger). Default is true.

func WithLogStart

func WithLogStart(v bool) Option

WithLogStart enables an Info log at the beginning of each invocation (requires WithLogger).

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger sets the slog logger used for optional start and error/panic logs.

Jump to

Keyboard shortcuts

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