Documentation ¶
Overview ¶
modulators package supplies a number of observer modulators for managing the chattiness of loggers.
Index ¶
- type Filter
- type IterationCountFilter
- type IterationElapsedTimeFilter
- type NullFilter
- type PercentileOfIterationsPerAnnealingFilter
- func (m *PercentileOfIterationsPerAnnealingFilter) ShouldFilter(event observer.Event) bool
- func (m *PercentileOfIterationsPerAnnealingFilter) WithMaximumIterations(MaximumIterations uint64) *PercentileOfIterationsPerAnnealingFilter
- func (m *PercentileOfIterationsPerAnnealingFilter) WithPercentileOfIterations(percentile float64) *PercentileOfIterationsPerAnnealingFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter interface { // ShouldFilter accepts an Event and decides whether it should be filtered (not logged). // This method returns true iff the logger is to ignore observer the supplied event. ShouldFilter(event observer.Event) bool }
Filter describes an interface to object that decides on how observer should be filtered (reduced in volume of entries logged).
type IterationCountFilter ¶
type IterationCountFilter struct {
// contains filtered or unexported fields
}
IterationCountFilter modulates FinishedIteration Annealing Event instances at a rate of 1 every modulo events. StartedIteration events are completely filtered out. All other event types are allowed through to the LogHandler.
func (*IterationCountFilter) ShouldFilter ¶
func (m *IterationCountFilter) ShouldFilter(event observer.Event) bool
ShouldFilter modulates only FinishedIteration Event instances, and fully filters out all StartedIteration events. Every modulo FinishedIteration events received, one is allowed through to the LogHandler. The very first and very last FinishedIteration events are exceptions, and are also not filtered.
func (*IterationCountFilter) ShouldFilterAnnealerSource ¶
func (m *IterationCountFilter) ShouldFilterAnnealerSource(event observer.Event) bool
func (*IterationCountFilter) WithModulo ¶
func (m *IterationCountFilter) WithModulo(modulo uint64) *IterationCountFilter
WithModulo defines the modulo to apply against FinishedIteration Annealing Event instances.
type IterationElapsedTimeFilter ¶
type IterationElapsedTimeFilter struct {
// contains filtered or unexported fields
}
IterationElapsedTimeFilter is a Filter that will not modulate any Event types except StartedIteration & FinishedIteration. It completely filters out all StartedIteration events, and modulates FinishedIteration events at a rate of one event per every lapsed wait duration specified. The very first very last events are exceptions, and are also not modulated.
func (*IterationElapsedTimeFilter) ShouldFilter ¶
func (m *IterationElapsedTimeFilter) ShouldFilter(event observer.Event) bool
ShouldFilter returns true for most FinishedIteration Event instances. Those allowed through to the logger are either 1) the very first or very last event, or 2) the closest FinishedIteration event to have occurred after the wait duration has passed since the last previous event allowed through.
func (*IterationElapsedTimeFilter) ShouldFilterAnnealerSource ¶
func (m *IterationElapsedTimeFilter) ShouldFilterAnnealerSource(event observer.Event) bool
func (*IterationElapsedTimeFilter) WithWait ¶
func (m *IterationElapsedTimeFilter) WithWait(wait time.Duration) *IterationElapsedTimeFilter
WithWait sets the wait duration between allowing FinishedIteration Event instances through to a LogHandler.
type NullFilter ¶
type NullFilter struct{}
NullFilter is a default Filter that doesn't actually filter observer, allowing all events through.
func (*NullFilter) ShouldFilter ¶
func (nm *NullFilter) ShouldFilter(event observer.Event) bool
ShouldFilter always returns false (do not filter the log of events)
type PercentileOfIterationsPerAnnealingFilter ¶
type PercentileOfIterationsPerAnnealingFilter struct { MaximumIterations uint64 // contains filtered or unexported fields }
PercentileOfIterationsPerAnnealingFilter filters FinishedIteration Annealing Event instances at a rate of 1 every percentile number of iterations received. . StartedIteration events are completely filtered out. All other event types are allowed through to the LogHandler.
func (*PercentileOfIterationsPerAnnealingFilter) ShouldFilter ¶
func (m *PercentileOfIterationsPerAnnealingFilter) ShouldFilter(event observer.Event) bool
func (*PercentileOfIterationsPerAnnealingFilter) WithMaximumIterations ¶
func (m *PercentileOfIterationsPerAnnealingFilter) WithMaximumIterations(MaximumIterations uint64) *PercentileOfIterationsPerAnnealingFilter
WithPercentileOfIterations defines the number of Annealing Iteration Event instances to report over the entire run.
func (*PercentileOfIterationsPerAnnealingFilter) WithPercentileOfIterations ¶
func (m *PercentileOfIterationsPerAnnealingFilter) WithPercentileOfIterations(percentile float64) *PercentileOfIterationsPerAnnealingFilter
WithPercentileOfIterations defines the number of Annealing Iteration Event instances to report over the entire run.