Documentation ¶
Index ¶
- Constants
- func CalcAvailability(results []cache.Result, pollerName string, ...)
- func EvalAggregate(result cache.ResultInfo, resultStats *threadsafe.ResultStatValHistory, ...) (bool, string, string)
- func EvalCacheWithStatusInfo(result cache.ResultInfo, mc *tc.TrafficMonitorConfigMap, status tc.CacheStatus, ...) (bool, string, string)
- func EvalInterface(infVitals map[string]cache.Vitals, inf tc.ServerInterfaceInfo) (bool, string)
- func GetVitals(newResult *cache.Result, prevResult *cache.Result, ...)
- type Event
- type ThreadsafeEvents
- type Time
Constants ¶
const AvailableStr = "available"
AvailableStr is used to describe the state of a cache server that is available to serve traffic.
const (
DeliveryServiceEventType = "DELIVERYSERVICE"
)
UnavailableStr is used to describe the state of a cache server that is not available to serve traffic.
Variables ¶
This section is empty.
Functions ¶
func CalcAvailability ¶
func CalcAvailability( results []cache.Result, pollerName string, statResultHistory *threadsafe.ResultStatHistory, mc tc.TrafficMonitorConfigMap, toData todata.TOData, localCacheStatusThreadsafe threadsafe.CacheAvailableStatus, localStates peer.CRStatesThreadsafe, events ThreadsafeEvents, protocol config.PollingProtocol, )
CalcAvailability calculates the availability of each cache in results. statResultHistory may be nil, in which case stats won't be used to calculate availability.
func EvalAggregate ¶
func EvalAggregate(result cache.ResultInfo, resultStats *threadsafe.ResultStatValHistory, mc *tc.TrafficMonitorConfigMap) (bool, string, string)
EvalAggregate calculates the availability of a cache server as an aggregate of server metrics and metrics of its network interfaces.
func EvalCacheWithStatusInfo ¶
func EvalCacheWithStatusInfo(result cache.ResultInfo, mc *tc.TrafficMonitorConfigMap, status tc.CacheStatus, serverStatus string) (bool, string, string)
EvalCacheWithStatusInfo evaluates whether the given cache should be marked available, taking the server's configured Status into account as well as its polling information.
func EvalInterface ¶
EvalInterface returns whether the given interface should be marked available, a boolean of whether the result was over IPv4 (false means it was IPv6), a string describing why, and which stat exceeded a threshold. The `stats` may be nil, for pollers which don't poll stats. The availability of EvalCache MAY NOT be used to directly set the cache's local availability, because the threshold stats may not be part of the poller which produced the result. Rather, if the cache was previously unavailable from a threshold, it must be verified that threshold stat is in the results before setting the cache to available. The resultStats may be nil, and if so, won't be checked for thresholds. For example, the Health poller doesn't have Stats. TODO change to return a `cache.AvailableStatus`
Types ¶
type Event ¶
type Event struct { Time Time `json:"time"` Index uint64 `json:"index"` Description string `json:"description"` Name string `json:"name"` Hostname string `json:"hostname"` Type string `json:"type"` Available bool `json:"isAvailable"` IPv4Available bool `json:"ipv4Available"` IPv6Available bool `json:"ipv6Available"` }
Event represents an event change in aggregated data. For example, a cache being marked as unavailable.
type ThreadsafeEvents ¶
type ThreadsafeEvents struct {
// contains filtered or unexported fields
}
Events provides safe access for multiple goroutines readers and a single writer to a stored Events slice.
func NewThreadsafeEvents ¶
func NewThreadsafeEvents(maxEvents uint64) ThreadsafeEvents
NewEvents creates a new single-writer-multiple-reader Threadsafe object
func (*ThreadsafeEvents) Add ¶
func (o *ThreadsafeEvents) Add(e Event)
Add adds the given event. This is threadsafe for one writer, multiple readers. This MUST NOT be called by multiple threads, as it non-atomically fetches and adds.
func (*ThreadsafeEvents) Get ¶
func (o *ThreadsafeEvents) Get() []Event
Get returns the internal slice of Events for reading. This MUST NOT be modified. If modification is necessary, copy the slice.