Documentation
¶
Overview ¶
Package observability provides tools for observing the behavior of an application, such as logging, metrics collection and tracing.
Index ¶
- func NewDomainLogger(next twelf.Logger, env ax.Envelope) twelf.Logger
- func NewProjectionLogger(next twelf.Logger, env ax.Envelope) twelf.Logger
- type InboundHook
- type Logger
- type LoggingObserver
- func (o *LoggingObserver) AfterInbound(ctx context.Context, env endpoint.InboundEnvelope, err error)
- func (o *LoggingObserver) AfterOutbound(ctx context.Context, env endpoint.OutboundEnvelope, err error)
- func (o *LoggingObserver) BeforeInbound(ctx context.Context, env endpoint.InboundEnvelope)
- func (o *LoggingObserver) BeforeOutbound(ctx context.Context, env endpoint.OutboundEnvelope)
- type NullObserver
- func (NullObserver) AfterInbound(context.Context, endpoint.InboundEnvelope, error)
- func (NullObserver) AfterOutbound(context.Context, endpoint.OutboundEnvelope, error)
- func (NullObserver) BeforeInbound(context.Context, endpoint.InboundEnvelope)
- func (NullObserver) BeforeOutbound(context.Context, endpoint.OutboundEnvelope)
- type Observer
- type OutboundHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDomainLogger ¶
NewDomainLogger returns a new logger that can be used to log information about the domain logic that results from handling env.Message.
Types ¶
type InboundHook ¶
type InboundHook struct { Observers []Observer Next endpoint.InboundPipeline }
InboundHook is an inbound pipeline stage that invokes hook methods on a set of observers.
func (*InboundHook) Accept ¶
func (h *InboundHook) Accept(ctx context.Context, s endpoint.MessageSink, env endpoint.InboundEnvelope) error
Accept forwards an inbound message through the pipeline until it is handled by some application-defined message handler(s).
func (*InboundHook) Initialize ¶
Initialize is called during initialization of the endpoint, after the transport is initialized. It can be used to inspect or further configure the endpoint as per the needs of the pipeline.
type Logger ¶
Logger is an implementation of twelf.Logger that adds information about the messaging being handled.
func (*Logger) Debug ¶
Debug writes a debug log message formatted according to a format specifier.
If IsDebug() returns false, no logging is performed.
It should be used for messages that are intended for the software developers that maintain the application.
f is the format specifier, as per fmt.Printf(), etc.
func (*Logger) DebugString ¶
DebugString writes a pre-formatted debug log message.
If IsDebug() returns false, no logging is performed.
It should be used for messages that are intended for the software developers that maintain the application.
func (*Logger) IsDebug ¶
IsDebug returns true if this logger will perform debug logging.
Generally the application should just call Debug() or DebugString() without calling IsDebug(), however it can be used to check if debug logging is necessary before executing expensive code that is only used to obtain debug information.
type LoggingObserver ¶
LoggingObserver is an observer that logs about messages.
func (*LoggingObserver) AfterInbound ¶
func (o *LoggingObserver) AfterInbound(ctx context.Context, env endpoint.InboundEnvelope, err error)
AfterInbound logs information about errors that occur processing an inbound message.
func (*LoggingObserver) AfterOutbound ¶
func (o *LoggingObserver) AfterOutbound(ctx context.Context, env endpoint.OutboundEnvelope, err error)
AfterOutbound logs information about an outbound message.
func (*LoggingObserver) BeforeInbound ¶
func (o *LoggingObserver) BeforeInbound(ctx context.Context, env endpoint.InboundEnvelope)
BeforeInbound logs information about an inbound message.
func (*LoggingObserver) BeforeOutbound ¶
func (o *LoggingObserver) BeforeOutbound(ctx context.Context, env endpoint.OutboundEnvelope)
BeforeOutbound logs information about an outbound message.
type NullObserver ¶
type NullObserver struct{}
NullObserver is an observer that does nothing.
It can be embedded into observer implementations to avoid having to write empty methods.
func (NullObserver) AfterInbound ¶
func (NullObserver) AfterInbound(context.Context, endpoint.InboundEnvelope, error)
AfterInbound is called after a message is accepted by the next pipeline stage. err is the error returned by the next pipeline stage, which may be nil.
func (NullObserver) AfterOutbound ¶
func (NullObserver) AfterOutbound(context.Context, endpoint.OutboundEnvelope, error)
AfterOutbound is called after a message is accepted by the next pipeline stage. err is the error returned by the next pipeline stage, which may be nil.
func (NullObserver) BeforeInbound ¶
func (NullObserver) BeforeInbound(context.Context, endpoint.InboundEnvelope)
BeforeInbound is called before a message is passed to the next pipeline stage.
func (NullObserver) BeforeOutbound ¶
func (NullObserver) BeforeOutbound(context.Context, endpoint.OutboundEnvelope)
BeforeOutbound is called before a message is passed to the next pipeline stage.
type Observer ¶
type Observer interface { // BeforeInbound is called before a message is passed to the next pipeline stage. BeforeInbound(ctx context.Context, env endpoint.InboundEnvelope) // AfterInbound is called after a message is accepted by the next pipeline stage. // err is the error returned by the next pipeline stage, which may be nil. AfterInbound(ctx context.Context, env endpoint.InboundEnvelope, err error) // BeforeOutbound is called before a message is passed to the next pipeline stage. BeforeOutbound(ctx context.Context, env endpoint.OutboundEnvelope) // AfterOutbound is called after a message is accepted by the next pipeline stage. // err is the error returned by the next pipeline stage, which may be nil. AfterOutbound(ctx context.Context, env endpoint.OutboundEnvelope, err error) }
Observer is an interface for types that observe the messages sent and received by an endpoint.
type OutboundHook ¶
type OutboundHook struct { Observers []Observer Next endpoint.OutboundPipeline }
OutboundHook is an outbound pipeline stage that invokes hook methods on a set of observers.
func (*OutboundHook) Accept ¶
func (h *OutboundHook) Accept(ctx context.Context, env endpoint.OutboundEnvelope) error
Accept processes the message encapsulated in env.
func (*OutboundHook) Initialize ¶
Initialize is called during initialization of the endpoint, after the transport is initialized. It can be used to inspect or further configure the endpoint as per the needs of the pipeline.