|
|
@ -182,7 +182,7 @@ func (qs *QuerySamples) totalSamplesPerStepPoints() []stepStat { |
|
|
|
|
|
|
|
|
|
|
|
ts := make([]stepStat, len(qs.TotalSamplesPerStep)) |
|
|
|
ts := make([]stepStat, len(qs.TotalSamplesPerStep)) |
|
|
|
for i, c := range qs.TotalSamplesPerStep { |
|
|
|
for i, c := range qs.TotalSamplesPerStep { |
|
|
|
ts[i] = stepStat{T: qs.startTimestamp + int64(i)*qs.interval, V: c} |
|
|
|
ts[i] = stepStat{T: qs.StartTimestamp + int64(i)*qs.Interval, V: c} |
|
|
|
} |
|
|
|
} |
|
|
|
return ts |
|
|
|
return ts |
|
|
|
} |
|
|
|
} |
|
|
@ -246,8 +246,8 @@ type QuerySamples struct { |
|
|
|
TotalSamplesPerStep []int64 |
|
|
|
TotalSamplesPerStep []int64 |
|
|
|
|
|
|
|
|
|
|
|
EnablePerStepStats bool |
|
|
|
EnablePerStepStats bool |
|
|
|
startTimestamp int64 |
|
|
|
StartTimestamp int64 |
|
|
|
interval int64 |
|
|
|
Interval int64 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type Stats struct { |
|
|
|
type Stats struct { |
|
|
@ -262,8 +262,8 @@ func (qs *QuerySamples) InitStepTracking(start, end, interval int64) { |
|
|
|
|
|
|
|
|
|
|
|
numSteps := int((end-start)/interval) + 1 |
|
|
|
numSteps := int((end-start)/interval) + 1 |
|
|
|
qs.TotalSamplesPerStep = make([]int64, numSteps) |
|
|
|
qs.TotalSamplesPerStep = make([]int64, numSteps) |
|
|
|
qs.startTimestamp = start |
|
|
|
qs.StartTimestamp = start |
|
|
|
qs.interval = interval |
|
|
|
qs.Interval = interval |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// IncrementSamplesAtStep increments the total samples count. Use this if you know the step index.
|
|
|
|
// IncrementSamplesAtStep increments the total samples count. Use this if you know the step index.
|
|
|
@ -287,7 +287,7 @@ func (qs *QuerySamples) IncrementSamplesAtTimestamp(t, samples int64) { |
|
|
|
qs.TotalSamples += samples |
|
|
|
qs.TotalSamples += samples |
|
|
|
|
|
|
|
|
|
|
|
if qs.TotalSamplesPerStep != nil { |
|
|
|
if qs.TotalSamplesPerStep != nil { |
|
|
|
i := int((t - qs.startTimestamp) / qs.interval) |
|
|
|
i := int((t - qs.StartTimestamp) / qs.Interval) |
|
|
|
qs.TotalSamplesPerStep[i] += samples |
|
|
|
qs.TotalSamplesPerStep[i] += samples |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|