Documentation
¶
Overview ¶
Package pathteststore handle pathtest storage
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ContextsLimit is the maximum number of contexts to keep in the store ContextsLimit int // TTL is the duration a Pathtest should run from discovery. // If a Pathtest is added again before the TTL expires, the TTL is reset to this duration. TTL time.Duration // Interval defines how frequently pathtests should run Interval time.Duration // MaxPerMinute is a "circuit breaker" config that limits pathtests. 0 is unlimited. MaxPerMinute int // MaxBurstDuration is how long pathtest "budget" can build up in the rate limiter MaxBurstDuration time.Duration }
Config is the configuration for the PathtestStore
type PathtestContext ¶
PathtestContext contains Pathtest information and additional flush related data
func (*PathtestContext) LastFlushInterval ¶
func (p *PathtestContext) LastFlushInterval() time.Duration
LastFlushInterval returns last flush interval
func (*PathtestContext) SetLastFlushInterval ¶
func (p *PathtestContext) SetLastFlushInterval(lastFlushInterval time.Duration)
SetLastFlushInterval sets last flush interval
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is used to accumulate aggregated contexts
func NewPathtestStore ¶
func NewPathtestStore(config Config, logger log.Component, statsdClient ddgostatsd.ClientInterface, timeNow func() time.Time) *Store
NewPathtestStore creates a new Store
func (*Store) Flush ¶
func (f *Store) Flush() []*PathtestContext
Flush will flush specific Pathtest context (distinct hash) if nextRun is reached once a Pathtest context is flushed nextRun will be updated to the next flush time
ttl: ttl defines the duration we should keep a specific PathtestContext in `Store.contexts` after `lastSuccessfulFlush`. // Flow context in `Store.contexts` map will be deleted if `ttl` is reached to avoid keeping Pathtest context that are not seen anymore. We need to keep PathtestContext (contains `nextRun` and `lastSuccessfulFlush`) after flush to be able to flush at regular interval (`flushInterval`). Example, after a flush, PathtestContext will have a new nextRun, that will be the next flush time for new contexts being added.
func (*Store) GetContextsCount ¶
GetContextsCount returns pathtest contexts count