Documentation
¶
Overview ¶
Package decorators provides logging, metrics, tracing, and recovery wrappers for interfaces.AnyJob. They compose via Wrap(job).WithLogger(..).WithMetrics(..). WithTracing(..).WithRecovery().Build(), and are backward-compatible: a chain with no decorators returns the inner job unchanged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder wraps an AnyJob with optional logging, metrics, tracing, and recovery decorators.
func (*Builder) Build ¶
func (b *Builder) Build() interfaces.AnyJob
Build returns the decorated job. Decorators are layered innermost→outermost as recovery → logging → metrics → tracing, so a panic is converted first and the outer layers observe it as a normal failure. A chain with no decorators returns the inner job unchanged.
func (*Builder) WithLogger ¶
func (b *Builder) WithLogger(logger interfaces.Logger) *Builder
WithLogger adds structured logging around the job.
func (*Builder) WithMetrics ¶
func (b *Builder) WithMetrics(metrics interfaces.Metrics) *Builder
WithMetrics adds run-count + duration metrics around the job.
func (*Builder) WithRecovery ¶
WithRecovery adds panic→error recovery (innermost, so logging/metrics/tracing still observe the converted failure).
func (*Builder) WithTracing ¶
func (b *Builder) WithTracing(tracer interfaces.Tracer) *Builder
WithTracing adds a per-run span around the job.