mirror of
https://github.com/prometheus/prometheus
synced 2024-12-27 00:53:12 +00:00
Merge pull request #225 from prometheus/refactor/fmt-cleanups
Slice expression simplifications.
This commit is contained in:
commit
89de116ea9
@ -381,7 +381,7 @@ func optimizeForward(pending ops) (out ops) {
|
||||
tail ops
|
||||
)
|
||||
|
||||
pending = pending[1:len(pending)]
|
||||
pending = pending[1:]
|
||||
|
||||
switch t := head.(type) {
|
||||
case *getValuesAtTimeOp:
|
||||
@ -434,7 +434,7 @@ func optimizeForward(pending ops) (out ops) {
|
||||
switch next := peekOperation.(type) {
|
||||
// All values at a specific time may be elided into the range query.
|
||||
case *getValuesAtTimeOp:
|
||||
pending = pending[1:len(pending)]
|
||||
pending = pending[1:]
|
||||
continue
|
||||
case *getValuesAlongRangeOp:
|
||||
// Range queries should be concatenated if they overlap.
|
||||
@ -443,10 +443,10 @@ func optimizeForward(pending ops) (out ops) {
|
||||
|
||||
return optimizeForward(pending)
|
||||
} else {
|
||||
pending = pending[1:len(pending)]
|
||||
pending = pending[1:]
|
||||
}
|
||||
case *getValuesAtIntervalOp:
|
||||
pending = pending[1:len(pending)]
|
||||
pending = pending[1:]
|
||||
|
||||
if next.GreedierThan(t) {
|
||||
var (
|
||||
@ -488,7 +488,7 @@ func selectQueriesForTime(time time.Time, queries ops) (out ops) {
|
||||
}
|
||||
|
||||
out = append(out, queries[0])
|
||||
tail := selectQueriesForTime(time, queries[1:len(queries)])
|
||||
tail := selectQueriesForTime(time, queries[1:])
|
||||
|
||||
return append(out, tail...)
|
||||
}
|
||||
@ -682,7 +682,7 @@ func optimizeTimeGroups(pending ops) (out ops) {
|
||||
)
|
||||
|
||||
out = optimizeTimeGroup(groupedQueries)
|
||||
pending = pending[len(groupedQueries):len(pending)]
|
||||
pending = pending[len(groupedQueries):]
|
||||
|
||||
tail := optimizeTimeGroups(pending)
|
||||
|
||||
|
@ -396,7 +396,7 @@ func (t TieredStorage) renderView(viewJob viewJob) {
|
||||
|
||||
// If we aimed past the newest value on disk, combine it with the next value from memory.
|
||||
if len(memValues) > 0 && diskValues.LastTimeBefore(targetTime) {
|
||||
latestDiskValue := diskValues[len(diskValues)-1 : len(diskValues)]
|
||||
latestDiskValue := diskValues[len(diskValues)-1:]
|
||||
chunk = append(latestDiskValue, memValues...)
|
||||
} else {
|
||||
chunk = diskValues
|
||||
|
Loading…
Reference in New Issue
Block a user