Documentation ¶
Index ¶
- Constants
- func Start(opsConfigFile string, cfg config.Config, appData config.StaticAppData, ...) error
- func StartDistributedPeerManager(distributedPeerChan <-chan peer.Result, localStates peer.CRStatesThreadsafe, ...)
- func StartHealthResultManager(cacheHealthChan <-chan cache.Result, toData todata.TODataThreadsafe, ...) (threadsafe.DurationMap, threadsafe.ResultHistory, threadsafe.UnpolledCaches)
- func StartMonitorConfigManager(monitorConfigPollChan <-chan poller.MonitorCfg, ...) threadsafe.TrafficMonitorConfigMap
- func StartOpsConfigManager(opsConfigFile string, toSession towrap.TrafficOpsSessionThreadsafe, ...) (threadsafe.OpsConfig, error)
- func StartPeerManager(peerChan <-chan peer.Result, peerStates peer.CRStatesPeersThreadsafe, ...)
- func StartStatHistoryManager(cacheStatChan <-chan cache.Result, localStates peer.CRStatesThreadsafe, ...) (threadsafe.ResultInfoHistory, threadsafe.ResultStatHistory, ...)
- func StartStateCombiner(events health.ThreadsafeEvents, peerStates peer.CRStatesPeersThreadsafe, ...) (peer.CRStatesThreadsafe, func())
- type CacheGroupNameSlice
- type PollIntervals
Constants ¶
const DefaultHealthConnectionTimeout = time.Second * 2
const PollIntervalRatio = float64(0.97) // TODO make config?
PollIntervalRatio is the ratio of the configuration interval to poll. The configured intervals are 'target' times, so we actually poll at some small fraction less, in attempt to make the actual poll marginally less than the target.
Variables ¶
This section is empty.
Functions ¶
func Start ¶
func Start(opsConfigFile string, cfg config.Config, appData config.StaticAppData, trafficMonitorConfigFileName string) error
Start starts the poller and handler goroutines
func StartDistributedPeerManager ¶
func StartDistributedPeerManager( distributedPeerChan <-chan peer.Result, localStates peer.CRStatesThreadsafe, distributedPeerStates peer.CRStatesPeersThreadsafe, events health.ThreadsafeEvents, unpolledCaches threadsafe.UnpolledCaches, )
StartDistributedPeerManager listens for distributed peer results and updates the localStates directly (because combining peerStates is unnecessary since these results are already combined among the distributed TM group they came from).
func StartHealthResultManager ¶
func StartHealthResultManager( cacheHealthChan <-chan cache.Result, toData todata.TODataThreadsafe, localStates peer.CRStatesThreadsafe, monitorConfig threadsafe.TrafficMonitorConfigMap, fetchCount threadsafe.Uint, cfg config.Config, events health.ThreadsafeEvents, localCacheStatus threadsafe.CacheAvailableStatus, cachesChanged <-chan struct{}, combineStates func(), ) (threadsafe.DurationMap, threadsafe.ResultHistory, threadsafe.UnpolledCaches)
StartHealthResultManager starts the goroutine which listens for health results. Note this polls the brief stat endpoint from ATS Astats, not the full stats. This poll should be quicker and less computationally expensive for ATS, but doesn't include all stat data needed for e.g. delivery service calculations.4 Returns the last health durations, events, the local cache statuses, and the health result history.
func StartMonitorConfigManager ¶
func StartMonitorConfigManager( monitorConfigPollChan <-chan poller.MonitorCfg, localStates peer.CRStatesThreadsafe, peerStates peer.CRStatesPeersThreadsafe, distributedPeerStates peer.CRStatesPeersThreadsafe, statURLSubscriber chan<- poller.CachePollerConfig, healthURLSubscriber chan<- poller.CachePollerConfig, peerURLSubscriber chan<- poller.PeerPollerConfig, distributedPeerURLSubscriber chan<- poller.PeerPollerConfig, toIntervalSubscriber chan<- time.Duration, cachesChangeSubscriber chan<- struct{}, cfg config.Config, staticAppData config.StaticAppData, toSession towrap.TrafficOpsSessionThreadsafe, toData todata.TODataThreadsafe, ) threadsafe.TrafficMonitorConfigMap
StartMonitorConfigManager runs the monitor config manager goroutine, and returns the threadsafe data which it sets.
func StartOpsConfigManager ¶
func StartOpsConfigManager( opsConfigFile string, toSession towrap.TrafficOpsSessionThreadsafe, toData todata.TODataThreadsafe, opsConfigChangeSubscribers []chan<- handler.OpsConfig, toChangeSubscribers []chan<- towrap.TrafficOpsSessionThreadsafe, localStates peer.CRStatesThreadsafe, peerStates peer.CRStatesPeersThreadsafe, distributedPeerStates peer.CRStatesPeersThreadsafe, combinedStates peer.CRStatesThreadsafe, statInfoHistory threadsafe.ResultInfoHistory, statResultHistory threadsafe.ResultStatHistory, statMaxKbpses threadsafe.CacheKbpses, healthHistory threadsafe.ResultHistory, lastStats threadsafe.LastStats, dsStats threadsafe.DSStatsReader, events health.ThreadsafeEvents, staticAppData config.StaticAppData, healthPollInterval time.Duration, lastHealthDurations threadsafe.DurationMap, fetchCount threadsafe.Uint, healthIteration threadsafe.Uint, errorCount threadsafe.Uint, localCacheStatus threadsafe.CacheAvailableStatus, statUnpolledCaches threadsafe.UnpolledCaches, healthUnpolledCaches threadsafe.UnpolledCaches, monitorConfig threadsafe.TrafficMonitorConfigMap, cfg config.Config, ) (threadsafe.OpsConfig, error)
StartOpsConfigManager starts the ops config manager goroutine, returning the (threadsafe) variables which it sets. Note the OpsConfigManager is in charge of the httpServer, because ops config changes trigger server changes. If other things needed to trigger server restarts, the server could be put in its own goroutine with signal channels
func StartPeerManager ¶
func StartPeerManager( peerChan <-chan peer.Result, peerStates peer.CRStatesPeersThreadsafe, events health.ThreadsafeEvents, combineState func(), )
StartPeerManager listens for peer results, and when it gets one, it adds it to the peerStates list, and optimistically combines the good results into combinedStates
func StartStatHistoryManager ¶
func StartStatHistoryManager( cacheStatChan <-chan cache.Result, localStates peer.CRStatesThreadsafe, combinedStates peer.CRStatesThreadsafe, toData todata.TODataThreadsafe, cachesChanged <-chan struct{}, cfg config.Config, monitorConfig threadsafe.TrafficMonitorConfigMap, events health.ThreadsafeEvents, combineState func(), ) (threadsafe.ResultInfoHistory, threadsafe.ResultStatHistory, threadsafe.CacheKbpses, threadsafe.DurationMap, threadsafe.LastStats, threadsafe.DSStatsReader, threadsafe.UnpolledCaches, threadsafe.CacheAvailableStatus)
StartStatHistoryManager fetches the full statistics data from ATS Astats. This includes everything needed for all calculations, such as Delivery Services. This is expensive, though, and may be hard on ATS, so it should poll less often. For a fast 'is it alive' poll, use the Health Result Manager poll. Returns the stat history, the duration between the stat poll for each cache, the last Kbps data, the calculated Delivery Service stats, and the unpolled caches list.
func StartStateCombiner ¶
func StartStateCombiner(events health.ThreadsafeEvents, peerStates peer.CRStatesPeersThreadsafe, localStates peer.CRStatesThreadsafe, toData todata.TODataThreadsafe) (peer.CRStatesThreadsafe, func())
StartStateCombiner starts the State Combiner goroutine, and returns the threadsafe CombinedStates, and a func to signal to combine states.
Types ¶
type CacheGroupNameSlice ¶
type CacheGroupNameSlice []tc.CacheGroupName
CacheGroupNameSlice is a slice of cache names, which fulfills the `sort.Interface` interface.
func (CacheGroupNameSlice) Len ¶
func (p CacheGroupNameSlice) Len() int
func (CacheGroupNameSlice) Less ¶
func (p CacheGroupNameSlice) Less(i, j int) bool
func (CacheGroupNameSlice) Swap ¶
func (p CacheGroupNameSlice) Swap(i, j int)