Documentation ¶
Overview ¶
Package behavior holds build in [Behavior] implementations for [Mediator].
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogger ¶
NewLogger creates a new Slogger mediator.Behavior.
func NewOtelTracer ¶
func NewOtelTracer(opt ...OtelTracerOption) mediator.Behavior
NewOtelTracer creates a new OtelTracer mediator.Behavior.
Types ¶
type OtelTracer ¶
type OtelTracer struct {
// contains filtered or unexported fields
}
OtelTracer is a mediator.Behavior that adds tracing to the chain.
The behavior creates a new span for every request that passes through it and adds it to the context. It will also adjust the status and add an error attribute to the span if the resulting error of the request is not nil.
func (*OtelTracer) Handler ¶
func (b *OtelTracer) Handler(next mediator.Handler) mediator.Handler
Handler runs the OtelTracer behavior.
type OtelTracerOption ¶
type OtelTracerOption func(*otelTracerOptions)
OtelTracerOption defines the method to customize NewOtelTracer.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) OtelTracerOption
WithTracerProvider overwrites the [tracer.TracerProvider] that the OtelTracer mediator.Behavior uses.
type Slogger ¶
type Slogger struct {
// contains filtered or unexported fields
}
Slogger is a mediator.Behavior that adds logging to the chain.
The logger behavior adds a `request` slog.Attr with the request name to the logger that is passed through it. It also logs the request after it is handled. This includes the time it took to handle the request and the error if it is not nil.