1 parent
de13d851a8
commit
a28362b82c
34 files changed
+1541
-341
No files matched your search
+47
-17
@@ -20,15 +20,25 @@ type FleetNode struct {
|
||||
// valid. Percentile latency is intentionally excluded: it cannot be computed
|
||||
// from separately reported per-node p50/p95/p99 values.
|
||||
type FleetPoint struct {
|
||||
Time time.Time `json:"time"`
|
||||
QueryRate *float64 `json:"queryRate"`
|
||||
NoErrorRate *float64 `json:"noerror"`
|
||||
NXDomainRate *float64 `json:"nxdomain"`
|
||||
ServFailRate *float64 `json:"servfail"`
|
||||
RefusedRate *float64 `json:"refused"`
|
||||
BlockedRate *float64 `json:"blocked"`
|
||||
CacheHitRate *float64 `json:"cacheHitRate"`
|
||||
Contributors int `json:"contributors"`
|
||||
Time time.Time `json:"time"`
|
||||
QueryRate *float64 `json:"queryRate"`
|
||||
NoErrorRate *float64 `json:"noerror"`
|
||||
NXDomainRate *float64 `json:"nxdomain"`
|
||||
ServFailRate *float64 `json:"servfail"`
|
||||
RefusedRate *float64 `json:"refused"`
|
||||
BlockedRate *float64 `json:"blocked"`
|
||||
RateLimitedRate *float64 `json:"rateLimitedRate"`
|
||||
SourceAuthRate *float64 `json:"authoritativeRate"`
|
||||
SourceRecursiveRate *float64 `json:"recursiveRate"`
|
||||
SourceForwardRate *float64 `json:"forwardRate"`
|
||||
SourceCacheRate *float64 `json:"cacheSourceRate"`
|
||||
CacheHitsRate *float64 `json:"cacheHitsRate"`
|
||||
CacheMissesRate *float64 `json:"cacheMissesRate"`
|
||||
CacheEvictionsRate *float64 `json:"cacheEvictionsRate"`
|
||||
CacheEntries *float64 `json:"cacheEntries"`
|
||||
ErrorRate *float64 `json:"errorRate"`
|
||||
CacheHitRate *float64 `json:"cacheHitRate"`
|
||||
Contributors int `json:"contributors"`
|
||||
}
|
||||
|
||||
const fleetStep = 15 * time.Second
|
||||
@@ -63,7 +73,7 @@ func AggregateFleet(nodes []FleetNode) []FleetPoint {
|
||||
if end.Before(start) {
|
||||
return nil
|
||||
}
|
||||
// Bound comparison data to the same six-hour, 1440-poll memory horizon as
|
||||
// Bound comparison data to the same 24-hour rolling memory horizon as
|
||||
// each node's History. Never add empty points before the first poll.
|
||||
if end.Sub(start) > time.Duration(maxSamples-1)*fleetStep {
|
||||
start = end.Add(-time.Duration(maxSamples-1) * fleetStep)
|
||||
@@ -73,8 +83,10 @@ func AggregateFleet(nodes []FleetNode) []FleetPoint {
|
||||
for t := start; !t.After(end); t = t.Add(fleetStep) {
|
||||
point := FleetPoint{Time: t}
|
||||
var query, noerror, nxdomain, servfail, refused, blocked float64
|
||||
var hitQPS, missQPS float64
|
||||
var hitQPS, missQPS, evictQPS, cacheEntries float64
|
||||
var limit, auth, recursive, forward, cached float64
|
||||
cacheComplete := true
|
||||
extraComplete := true
|
||||
for i, n := range nodes {
|
||||
for index[i] < len(n.Samples) && !n.Samples[index[i]].Time.After(t) {
|
||||
index[i]++
|
||||
@@ -95,20 +107,38 @@ func AggregateFleet(nodes []FleetNode) []FleetPoint {
|
||||
servfail += *sample.ServFailRate
|
||||
refused += *sample.RefusedRate
|
||||
blocked += *sample.BlockedRate
|
||||
if sample.cacheHitQPS == nil || sample.cacheMissQPS == nil {
|
||||
if sample.CacheHitsRate == nil || sample.CacheMissesRate == nil {
|
||||
cacheComplete = false
|
||||
} else {
|
||||
hitQPS += *sample.cacheHitQPS
|
||||
missQPS += *sample.cacheMissQPS
|
||||
hitQPS += *sample.CacheHitsRate
|
||||
missQPS += *sample.CacheMissesRate
|
||||
}
|
||||
if sample.RateLimitedRate == nil || sample.SourceAuthRate == nil || sample.SourceRecursiveRate == nil || sample.SourceForwardRate == nil || sample.SourceCacheRate == nil || sample.CacheEvictionsRate == nil {
|
||||
extraComplete = false
|
||||
} else {
|
||||
limit += *sample.RateLimitedRate
|
||||
auth += *sample.SourceAuthRate
|
||||
recursive += *sample.SourceRecursiveRate
|
||||
forward += *sample.SourceForwardRate
|
||||
cached += *sample.SourceCacheRate
|
||||
evictQPS += *sample.CacheEvictionsRate
|
||||
}
|
||||
cacheEntries += sample.CacheEntries
|
||||
}
|
||||
if point.Contributors == len(nodes) {
|
||||
point.QueryRate, point.NoErrorRate, point.NXDomainRate = &query, &noerror, &nxdomain
|
||||
point.ServFailRate, point.RefusedRate, point.BlockedRate = &servfail, &refused, &blocked
|
||||
if cacheComplete && hitQPS+missQPS > 0 {
|
||||
ratio := 100 * hitQPS / (hitQPS + missQPS)
|
||||
point.CacheHitRate = &ratio
|
||||
if cacheComplete {
|
||||
point.CacheHitsRate, point.CacheMissesRate = &hitQPS, &missQPS
|
||||
point.CacheHitRate = cachePercent(point.CacheHitsRate, point.CacheMissesRate)
|
||||
}
|
||||
point.CacheEntries = &cacheEntries
|
||||
if extraComplete {
|
||||
point.RateLimitedRate, point.SourceAuthRate = &limit, &auth
|
||||
point.SourceRecursiveRate, point.SourceForwardRate = &recursive, &forward
|
||||
point.SourceCacheRate, point.CacheEvictionsRate = &cached, &evictQPS
|
||||
}
|
||||
point.ErrorRate = errorPercent(point.QueryRate, point.ServFailRate, point.RefusedRate)
|
||||
}
|
||||
points = append(points, point)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user