Documentation ¶
Overview ¶
package tmcheck contains utility functions for validating a Traffic Monitor is acting correctly.
Index ¶
- Constants
- func AllMonitorsCRStatesOfflineValidator(toClient *to.Session, interval time.Duration, includeOffline bool, ...)
- func AllMonitorsDSStatsValidator(toClient *to.Session, interval time.Duration, includeOffline bool, ...)
- func AllMonitorsQueryIntervalValidator(toClient *to.Session, interval time.Duration, includeOffline bool, ...)
- func AllValidator(toClient *to.Session, interval time.Duration, includeOffline bool, ...)
- func CRStatesOfflineValidator(tmURI string, toClient *to.Session, interval time.Duration, ...)
- func DSStatsValidator(tmURI string, toClient *to.Session, interval time.Duration, ...)
- func FilterOfflines(servers []tc.Server) []tc.Server
- func GetCDN(uri string) (string, error)
- func GetCDNs(servers []tc.Server) map[tc.CDNName]struct{}
- func GetCRConfigs(cdns map[tc.CDNName]struct{}, toClient *to.Session) map[tc.CDNName]CRConfigOrError
- func GetCRStates(uri string) (*tc.CRStates, error)
- func GetDSStats(uri string) (*dsdata.StatsOld, error)
- func GetMonitors(toClient *to.Session, includeOffline bool) ([]tc.Server, error)
- func GetOldestPolledPeerTime(uri string) (time.Duration, error)
- func GetStats(uri string) (*datareq.Stats, error)
- func PeerPollersAllValidator(toClient *to.Session, interval time.Duration, includeOffline bool, ...)
- func PeerPollersValidator(tmURI string, toClient *to.Session, interval time.Duration, ...)
- func QueryIntervalValidator(tmURI string, toClient *to.Session, interval time.Duration, ...)
- func ValidateAllMonitorsDSStats(toClient *to.Session, includeOffline bool) (map[tc.TrafficMonitorName]error, error)
- func ValidateAllMonitorsOfflineStates(toClient *to.Session, includeOffline bool) (map[tc.TrafficMonitorName]error, error)
- func ValidateAllMonitorsQueryInterval(toClient *to.Session, includeOffline bool) (map[tc.TrafficMonitorName]error, error)
- func ValidateAllPeerPollers(toClient *to.Session, includeOffline bool) (map[tc.TrafficMonitorName]error, error)
- func ValidateCRStates(crstates *tc.CRStates, crconfig *tc.CRConfig) error
- func ValidateDSStats(tmURI string, toClient *to.Session) error
- func ValidateDSStatsData(dsStats *dsdata.StatsOld, crconfig *tc.CRConfig) error
- func ValidateDSStatsWithCDN(tmURI string, tmCDN string, toClient *to.Session) error
- func ValidateDSStatsWithCRConfig(tmURI string, crConfig *tc.CRConfig, toClient *to.Session) error
- func ValidateOfflineStates(tmURI string, toClient *to.Session) error
- func ValidateOfflineStatesWithCDN(tmURI string, tmCDN string, toClient *to.Session) error
- func ValidateOfflineStatesWithCRConfig(tmURI string, crConfig *tc.CRConfig, toClient *to.Session) error
- func ValidatePeerPoller(uri string) error
- func ValidateQueryInterval(tmURI string, toClient *to.Session) error
- func Validator(tmURI string, toClient *to.Session, interval time.Duration, ...)
- type AllValidatorFunc
- type CRConfigOrError
- type TrafficMonitorConfigDoc
- type ValidatorFunc
Constants ¶
const PeerPollMax = time.Duration(10) * time.Second
const QueryIntervalMax = time.Duration(10) * time.Second
const RequestTimeout = time.Second * time.Duration(30)
const TrafficMonitorCRStatesPath = "/publish/CrStates"
const TrafficMonitorConfigDocPath = "/publish/ConfigDoc"
const TrafficMonitorDSStatsPath = "/publish/DsStats"
const TrafficMonitorStatsPath = "/publish/Stats"
Variables ¶
This section is empty.
Functions ¶
func AllMonitorsCRStatesOfflineValidator ¶
func AllMonitorsCRStatesOfflineValidator( toClient *to.Session, interval time.Duration, includeOffline bool, grace time.Duration, onErr func(tc.TrafficMonitorName, error), onResumeSuccess func(tc.TrafficMonitorName), onCheck func(tc.TrafficMonitorName, error), )
AllMonitorsCRStatesOfflineValidator is designed to be run as a goroutine, and does not return. It continously validates every `interval`, and calls `onErr` on failure, `onResumeSuccess` when a failure ceases, and `onCheck` on every poll. Note the error passed to `onErr` may be a general validation error not associated with any monitor, in which case the passed `tc.TrafficMonitorName` will be empty.
func AllMonitorsDSStatsValidator ¶
func AllMonitorsDSStatsValidator( toClient *to.Session, interval time.Duration, includeOffline bool, grace time.Duration, onErr func(tc.TrafficMonitorName, error), onResumeSuccess func(tc.TrafficMonitorName), onCheck func(tc.TrafficMonitorName, error), )
AllMonitorsDSStatsValidator is designed to be run as a goroutine, and does not return. It continously validates every `interval`, and calls `onErr` on failure, `onResumeSuccess` when a failure ceases, and `onCheck` on every poll. Note the error passed to `onErr` may be a general validation error not associated with any monitor, in which case the passed `tc.TrafficMonitorName` will be empty.
func AllMonitorsQueryIntervalValidator ¶
func AllMonitorsQueryIntervalValidator( toClient *to.Session, interval time.Duration, includeOffline bool, grace time.Duration, onErr func(tc.TrafficMonitorName, error), onResumeSuccess func(tc.TrafficMonitorName), onCheck func(tc.TrafficMonitorName, error), )
AllMonitorsQueryIntervalValidator is designed to be run as a goroutine, and does not return. It continously validates every `interval`, and calls `onErr` on failure, `onResumeSuccess` when a failure ceases, and `onCheck` on every poll. Note the error passed to `onErr` may be a general validation error not associated with any monitor, in which case the passed `tc.TrafficMonitorName` will be empty.
func AllValidator ¶
func AllValidator( toClient *to.Session, interval time.Duration, includeOffline bool, grace time.Duration, onErr func(tc.TrafficMonitorName, error), onResumeSuccess func(tc.TrafficMonitorName), onCheck func(tc.TrafficMonitorName, error), validator func(toClient *to.Session, includeOffline bool) (map[tc.TrafficMonitorName]error, error), )
func CRStatesOfflineValidator ¶
func CRStatesOfflineValidator( tmURI string, toClient *to.Session, interval time.Duration, grace time.Duration, onErr func(error), onResumeSuccess func(), onCheck func(error), )
CRStatesOfflineValidator is designed to be run as a goroutine, and does not return. It continously validates every `interval`, and calls `onErr` on failure, `onResumeSuccess` when a failure ceases, and `onCheck` on every poll.
func DSStatsValidator ¶
func DSStatsValidator( tmURI string, toClient *to.Session, interval time.Duration, grace time.Duration, onErr func(error), onResumeSuccess func(), onCheck func(error), )
DSStatsValidator is designed to be run as a goroutine, and does not return. It continously validates every `interval`, and calls `onErr` on failure, `onResumeSuccess` when a failure ceases, and `onCheck` on every poll.
func FilterOfflines ¶
func FilterOfflines(servers []tc.Server) []tc.Server
FilterOfflines returns only servers which are REPORTED or ONLINE
func GetCRConfigs ¶
func GetCRConfigs(cdns map[tc.CDNName]struct{}, toClient *to.Session) map[tc.CDNName]CRConfigOrError
func GetCRStates ¶
GetCRStates gets the CRStates from the given Traffic Monitor.
func GetDSStats ¶
GetDSStats gets the DSStats from the given Traffic Monitor.
func PeerPollersAllValidator ¶
func PeerPollersValidator ¶
func QueryIntervalValidator ¶
func QueryIntervalValidator( tmURI string, toClient *to.Session, interval time.Duration, grace time.Duration, onErr func(error), onResumeSuccess func(), onCheck func(error), )
QueryIntervalValidator is designed to be run as a goroutine, and does not return. It continously validates every `interval`, and calls `onErr` on failure, `onResumeSuccess` when a failure ceases, and `onCheck` on every poll.
func ValidateAllMonitorsDSStats ¶
func ValidateAllMonitorsDSStats(toClient *to.Session, includeOffline bool) (map[tc.TrafficMonitorName]error, error)
ValidateAllMonitorDSStats validates, for all monitors in the given Traffic Ops, DSStats contains all Delivery Services in the CRConfig.
func ValidateAllMonitorsOfflineStates ¶
func ValidateAllMonitorsOfflineStates(toClient *to.Session, includeOffline bool) (map[tc.TrafficMonitorName]error, error)
ValidateOfflineStates validates that no OFFLINE or ADMIN_DOWN caches in the given Traffic Ops' CRConfig are marked Available in the given Traffic Monitor's CRStates.
func ValidateAllMonitorsQueryInterval ¶
func ValidateAllMonitorsQueryInterval(toClient *to.Session, includeOffline bool) (map[tc.TrafficMonitorName]error, error)
ValidateAllMonitorsQueryInterval validates, for all monitors in the given Traffic Ops, an acceptable query interval 95th percentile.
func ValidateAllPeerPollers ¶
func ValidateCRStates ¶
func ValidateCRStates(crstates *tc.CRStates, crconfig *tc.CRConfig) error
ValidateCRStates validates that no OFFLINE or ADMIN_DOWN caches in the given CRConfig are marked Available in the given CRStates.
func ValidateDSStats ¶
ValidateDSStates validates that all Delivery Services in the CRConfig exist in given Traffic Monitor's DSStats. Existence in DSStats is useful to verify, because "Available: false" in CRStates
func ValidateDSStatsData ¶
ValidateDSStatsData validates that all delivery services in the given CRConfig with caches assigned exist in the given DSStats.
func ValidateDSStatsWithCDN ¶
ValidateOfflineStatesWithCDN validates per ValidateOfflineStates, but saves an additional query if the Traffic Monitor's CDN is known.
func ValidateDSStatsWithCRConfig ¶
ValidateOfflineStatesWithCRConfig validates per ValidateOfflineStates, but saves querying the CRconfig if it's already fetched.
func ValidateOfflineStates ¶
ValidateOfflineStates validates that no OFFLINE or ADMIN_DOWN caches in the given Traffic Ops' CRConfig are marked Available in the given Traffic Monitor's CRStates.
func ValidateOfflineStatesWithCDN ¶
ValidateOfflineStatesWithCDN validates per ValidateOfflineStates, but saves an additional query if the Traffic Monitor's CDN is known.
func ValidateOfflineStatesWithCRConfig ¶
func ValidateOfflineStatesWithCRConfig(tmURI string, crConfig *tc.CRConfig, toClient *to.Session) error
ValidateOfflineStatesWithCRConfig validates per ValidateOfflineStates, but saves querying the CRconfig if it's already fetched.
func ValidatePeerPoller ¶
func ValidateQueryInterval ¶
ValidateQueryInterval validates the given monitor has an acceptable Query Interval 95th percentile.
func Validator ¶
func Validator( tmURI string, toClient *to.Session, interval time.Duration, grace time.Duration, onErr func(error), onResumeSuccess func(), onCheck func(error), validator func(tmURI string, toClient *to.Session) error, )
CRStatesOfflineValidator is designed to be run as a goroutine, and does not return. It continously validates every `interval`, and calls `onErr` on failure, `onResumeSuccess` when a failure ceases, and `onCheck` on every poll.
Types ¶
type AllValidatorFunc ¶
type CRConfigOrError ¶
type CRConfigOrError struct { CRConfig *tc.CRConfig Err error }
CRConfigOrError contains a CRConfig or an error. Union types? Monads? What are those?
type TrafficMonitorConfigDoc ¶
type TrafficMonitorConfigDoc struct {
CDN string `json:"cdnName"`
}
TrafficMonitorConfigDoc represents the JSON returned by Traffic Monitor's ConfigDoc endpoint. This currently only contains the CDN member, as needed by this library.