filters

package
v0.0.0-...-c864ae1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2023 License: BSD-2-Clause, BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Overview

modulators package supplies a number of observer modulators for managing the chattiness of loggers.

Index

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

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 (*PercentileOfIterationsPerAnnealingFilter) WithMaximumIterations

WithPercentileOfIterations defines the number of Annealing Iteration Event instances to report over the entire run.

func (*PercentileOfIterationsPerAnnealingFilter) WithPercentileOfIterations

WithPercentileOfIterations defines the number of Annealing Iteration Event instances to report over the entire run.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL