Documentation ¶
Index ¶
- Variables
- type Filter
- type LastDSStat
- type LastStatData
- type LastStats
- type LastStatsData
- type Stat
- type StatBool
- type StatCacheStats
- type StatCommon
- func (a StatCommon) Available() StatBool
- func (a StatCommon) CacheReporting(name tc.CacheName) (bool, bool)
- func (a StatCommon) CachesAvailable() StatInt
- func (a StatCommon) CachesConfigured() StatInt
- func (a StatCommon) CachesReportingNames() []tc.CacheName
- func (a StatCommon) Copy() StatCommon
- func (a StatCommon) Error() StatString
- func (a StatCommon) Healthy() StatBool
- func (a StatCommon) Status() StatString
- type StatCommonReadonly
- type StatFloat
- type StatInt
- type StatMeta
- type StatName
- type StatOld
- type StatReadonly
- type StatString
- type Stats
- type StatsOld
- type StatsReadonly
Constants ¶
This section is empty.
Variables ¶
var ErrNotProcessedStat = errors.New("This stat is not used.")
ErrNotProcessedStat indicates a stat received is not used by Traffic Monitor, nor returned by any API endpoint. Receiving this error indicates the stat has been discarded.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter interface { UseStat(name string) bool UseDeliveryService(name tc.DeliveryServiceName) bool WithinStatHistoryMax(int) bool }
Filter encapsulates functions to filter a given set of Stats, e.g. from HTTP query parameters. TODO combine with cache.Filter?
type LastDSStat ¶
type LastDSStat struct { Caches map[tc.CacheName]*LastStatsData CacheGroups map[tc.CacheGroupName]*LastStatsData Type map[tc.CacheType]*LastStatsData Total LastStatsData Available bool }
LastDSStat maps and aggregates the last stats received for the given delivery service to caches, cache groups, types, and total. TODO figure a way to associate this type with StatHTTP, with which its members correspond.
func (LastDSStat) Copy ¶
func (a LastDSStat) Copy() *LastDSStat
Copy performs a deep copy of this LastDSStat object.
type LastStatData ¶
LastStatData contains the value, time it was received, and per-second calculation since the previous stat, for a stat from a cache.
type LastStats ¶
type LastStats struct { DeliveryServices map[tc.DeliveryServiceName]*LastDSStat Caches map[tc.CacheName]*LastStatsData }
LastStats includes the previously recieved stats for DeliveryServices and Caches, the stat itself, when it was received, and the stat value per second.
func NewLastStats ¶
NewLastStats returns a new LastStats object, initializing internal pointer values.
type LastStatsData ¶
type LastStatsData struct { Bytes LastStatData Status2xx LastStatData Status3xx LastStatData Status4xx LastStatData Status5xx LastStatData }
LastStatsData contains the last stats and per-second calculations for bytes and status codes received from a cache. TODO sync.Pool?
func (*LastStatsData) Sum ¶
func (a *LastStatsData) Sum(b *LastStatsData)
Sum returns the Sum() of each member data with the given LastStatsData corresponding members
type Stat ¶
type Stat struct { CommonStats StatCommon CacheGroups map[tc.CacheGroupName]*StatCacheStats Types map[tc.CacheType]*StatCacheStats Caches map[tc.CacheName]*StatCacheStats TotalStats StatCacheStats }
Stat represents a complete delivery service stat, for a given poll, or at the time requested.
func NewStat ¶
func NewStat() *Stat
NewStat returns a new delivery service Stat, initializing pointer members.
func (*Stat) CacheGroup ¶
func (a *Stat) CacheGroup(name tc.CacheGroupName) (*StatCacheStats, bool)
CacheGroup returns the data for the given cachegroup in this stat. It is part of the StatCommonReadonly interface.
func (*Stat) Common ¶
func (a *Stat) Common() StatCommonReadonly
Common returns the common stat data for this stat. It is part of the StatCommonReadonly interface.
func (Stat) Copy ¶
Copy performs a deep copy of this Stat. It does not modify, and is thus safe for multiple goroutines.
func (*Stat) Total ¶
func (a *Stat) Total() *StatCacheStats
Total returns the aggregated total data in this stat. It is part of the StatCommonReadonly interface.
func (*Stat) Type ¶
func (a *Stat) Type(name tc.CacheType) (*StatCacheStats, bool)
Type returns the aggregated data for the given cache type in this stat. It is part of the StatCommonReadonly interface.
type StatCacheStats ¶
type StatCacheStats struct { OutBytes StatInt `json:"out_bytes"` IsAvailable StatBool `json:"is_available"` Status5xx StatInt `json:"status_5xx"` Status4xx StatInt `json:"status_4xx"` Status3xx StatInt `json:"status_3xx"` Status2xx StatInt `json:"status_2xx"` InBytes StatFloat `json:"in_bytes"` Kbps StatFloat `json:"kbps"` Tps5xx StatFloat `json:"tps_5xx"` Tps4xx StatFloat `json:"tps_4xx"` Tps3xx StatFloat `json:"tps_3xx"` Tps2xx StatFloat `json:"tps_2xx"` ErrorString StatString `json:"error_string"` TpsTotal StatFloat `json:"tps_total"` }
StatCacheStats is all the stats generated by a cache. This may also be used for aggregate stats, for example, the summary of all cache stats for a cache group, or delivery service. Each stat is an array, in case there are multiple data points at different times. However, a single data point i.e. a single array member is common.
func (StatCacheStats) Sum ¶
func (a StatCacheStats) Sum(b StatCacheStats) StatCacheStats
Sum adds the given cache stats to this cache stats. Numeric values are summed; strings are appended.
type StatCommon ¶
type StatCommon struct { CachesConfiguredNum StatInt `json:"caches_configured"` CachesReporting map[tc.CacheName]bool `json:"caches_reporting"` ErrorStr StatString `json:"error_string"` StatusStr StatString `json:"status"` IsHealthy StatBool `json:"is_healthy"` IsAvailable StatBool `json:"is_available"` CachesAvailableNum StatInt `json:"caches_available"` CachesDisabled []string `json:"disabled_locations"` }
StatCommon contains stat data common to most delivery service stats.
func (StatCommon) Available ¶
func (a StatCommon) Available() StatBool
Available returns whether this delivery service is considered available by this stat. It is part of the StatCommonReadonly interface.
func (StatCommon) CacheReporting ¶
func (a StatCommon) CacheReporting(name tc.CacheName) (bool, bool)
CacheReporting returns the number of caches reporting for this delivery service stat. It is part of the StatCommonReadonly interface.
func (StatCommon) CachesAvailable ¶
func (a StatCommon) CachesAvailable() StatInt
CachesAvailable returns the number of caches available to the delivery service in this stat. It is part of the StatCommonReadonly interface.
func (StatCommon) CachesConfigured ¶
func (a StatCommon) CachesConfigured() StatInt
CachesConfigured returns the number of caches configured for this delivery service stat. It is part of the StatCommonReadonly interface.
func (StatCommon) CachesReportingNames ¶
func (a StatCommon) CachesReportingNames() []tc.CacheName
CachesReportingNames returns the list of caches reporting for this delivery service stat. It is part of the StatCommonReadonly interface.
func (StatCommon) Copy ¶
func (a StatCommon) Copy() StatCommon
Copy returns a deep copy of this StatCommon object.
func (StatCommon) Error ¶
func (a StatCommon) Error() StatString
Error returns the error string of this delivery service stat. It is part of the StatCommonReadonly interface.
func (StatCommon) Healthy ¶
func (a StatCommon) Healthy() StatBool
Healthy returns whether this delivery service is considered healthy by this stat. It is part of the StatCommonReadonly interface.
func (StatCommon) Status ¶
func (a StatCommon) Status() StatString
Status returns the status string of this delivery service stat. It is part of the StatCommonReadonly interface.
type StatCommonReadonly ¶
type StatCommonReadonly interface { Copy() StatCommon CachesConfigured() StatInt CachesReportingNames() []tc.CacheName Error() StatString Status() StatString Healthy() StatBool Available() StatBool CachesAvailable() StatInt }
StatCommonReadonly is a read-only interface for a delivery service's common Stat data, designed to be passed to multiple goroutine readers.
type StatMeta ¶
type StatMeta struct {
Time int64 `json:"time"`
}
StatMeta includes metadata about a particular stat.
type StatOld ¶
type StatOld struct { Time int64 `json:"time"` Value interface{} `json:"value"` Span int `json:"span,omitempty"` // TODO set? remove? Index int `json:"index,omitempty"` // TODO set? remove? }
StatOld is the old JSON representation of a stat, from Traffic Monitor 1.0.
type StatReadonly ¶
type StatReadonly interface { Copy() *Stat Common() StatCommonReadonly CacheGroup(name tc.CacheGroupName) (*StatCacheStats, bool) Type(name tc.CacheType) (*StatCacheStats, bool) Total() *StatCacheStats }
StatReadonly is a read-only interface for a delivery service Stat, designed to be passed to multiple goroutine readers.
type StatString ¶
StatString is a string stat, combined with its metadata
type Stats ¶
type Stats struct { DeliveryService map[tc.DeliveryServiceName]*Stat `json:"deliveryService"` Time time.Time `json:"-"` }
Stats is the JSON-serialisable representation of delivery service Stats. It maps delivery service names to individual stat objects.
func NewStats ¶
NewStats creates a new Stats object, initializing any pointer members. TODO rename to just 'New'?
func (Stats) Get ¶
func (s Stats) Get(name tc.DeliveryServiceName) (StatReadonly, bool)
Get returns the stats for the given delivery service, and whether it exists.
type StatsOld ¶
type StatsOld struct { DeliveryService map[tc.DeliveryServiceName]map[StatName][]StatOld `json:"deliveryService"` tc.CommonAPIData }
StatsOld is the old JSON representation of stats, from Traffic Monitor 1.0. It is designed to be serialized and returns from an API, and includes stat history for each delivery service, as well as data common to most endpoints.
type StatsReadonly ¶
type StatsReadonly interface { Get(tc.DeliveryServiceName) (StatReadonly, bool) JSON(Filter, url.Values) StatsOld }
StatsReadonly is a read-only interface for delivery service Stats, designed to be passed to multiple goroutine readers.