Documentation
¶
Overview ¶
Package logz provides events observer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Name can be used to identify observer instance in a group, for example a group of log levels.
Name string
// MaxCardinality limits number of distinct message families being tracked.
// All messages that exceed cardinality are grouped together as "other".
// Default 100.
MaxCardinality uint32
// MaxSamples limits a number of latest samples kept for a message family.
// Default 10.
MaxSamples uint32
// SamplingInterval is the minimum amount of time needed to pass from a last Sample collection in particular message family.
// Messages that are observed too quickly after last sampling are counted, but not sampled.
// Default 1ms.
SamplingInterval time.Duration
// DistResolution is the maximum number of time interval buckets to track distribution in time.
// Default 100.
DistResolution int
// DistRetentionPeriod is maximum age of bucket. Use -1 for unlimited.
// Default one week (168 hours).
DistRetentionPeriod time.Duration
// FilterMessage can reduce cardinality by filtering dynamic parts of messages.
// It uses github.com/vearutop/lograte/filter.Dynamic
// See https://pkg.go.dev/github.com/vearutop/lograte/filter#Dynamic.
// This option is not needed if you already have messages without dynamic interpolated values.
// This option worsen performance, so use it only if you need it.
FilterMessage bool
}
Config defines observer configuration.
type Entry ¶
type Entry struct {
Message string
Count uint64
Samples []Sample
First time.Time
Last time.Time
MaxBucketCount int
Buckets []Bucket
}
Entry contains aggregated information about message.
type Observer ¶
type Observer struct {
Config
PreparedObserver
// contains filtered or unexported fields
}
Observer keeps track of messages. Use NewObserver() to create new instance.
func (*Observer) ObserveMessage ¶
ObserveMessage updates aggregated information about message.
type PreparedObserver ¶ added in v1.3.0
type PreparedObserver struct {
// contains filtered or unexported fields
}
PreparedObserver keeps track of messages.
func NewObserver ¶ added in v1.3.0
func NewObserver(cfg Config) *PreparedObserver
NewObserver creates PreparedObserver.
func (*PreparedObserver) Find ¶ added in v1.3.0
func (l *PreparedObserver) Find(msg string) Entry
Find lookups entry by message.
func (*PreparedObserver) GetEntries ¶ added in v1.3.0
func (l *PreparedObserver) GetEntries() []Entry
GetEntries returns a list of observed event entries without data samples.
func (*PreparedObserver) GetEntriesWithSamples ¶ added in v1.3.0
func (l *PreparedObserver) GetEntriesWithSamples() []Entry
GetEntriesWithSamples returns a list of observed event entries with data samples.
func (*PreparedObserver) ObserveMessage ¶ added in v1.3.0
func (l *PreparedObserver) ObserveMessage(msg string, data interface{})
ObserveMessage updates aggregated information about message.
func (*PreparedObserver) Other ¶ added in v1.3.0
func (l *PreparedObserver) Other(withSamples bool) Entry
Other returns entry for other events.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ctxz implements wrapper to report aggregated messages for github.com/bool64/ctxd.Logger.
|
Package ctxz implements wrapper to report aggregated messages for github.com/bool64/ctxd.Logger. |
|
Package logzpage provides http handler to expose observed log samples.
|
Package logzpage provides http handler to expose observed log samples. |
|
Package zzap provides zpage observer for "go.uber.org/zap" logger.
|
Package zzap provides zpage observer for "go.uber.org/zap" logger. |
