Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(loki): extended tailing #764

Merged
merged 9 commits into from
Jul 19, 2019
Prev Previous commit
Next Next commit
fix: adapt tests to Lookback change
  • Loading branch information
sh0rez committed Jul 17, 2019
commit 843ed516ddbd9f4e7482cdf9e31f0b97ac3121eb
58 changes: 34 additions & 24 deletions pkg/storage/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,63 @@ var (
//go test -bench=. -benchmem -memprofile memprofile.out -cpuprofile profile.out
func Benchmark_store_LazyQueryRegexBackward(b *testing.B) {
benchmarkStoreQuery(b, &logproto.QueryRequest{
Query: "{foo=\"bar\"}",
Regex: "fuzz",
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
Query: "{foo=\"bar\"}",
Regex: "fuzz",
Lookback: &logproto.Lookback{
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
},
Direction: logproto.BACKWARD,
})
}

func Benchmark_store_LazyQueryLogQLBackward(b *testing.B) {
benchmarkStoreQuery(b, &logproto.QueryRequest{
Query: "{foo=\"bar\"} |= \"test\" != \"toto\"",
Regex: "fuzz",
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
Query: "{foo=\"bar\"} |= \"test\" != \"toto\"",
Regex: "fuzz",
Lookback: &logproto.Lookback{
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
},
Direction: logproto.BACKWARD,
})
}

func Benchmark_store_LazyQueryRegexForward(b *testing.B) {
benchmarkStoreQuery(b, &logproto.QueryRequest{
Query: "{foo=\"bar\"}",
Regex: "fuzz",
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
Query: "{foo=\"bar\"}",
Regex: "fuzz",
Lookback: &logproto.Lookback{
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
},
Direction: logproto.FORWARD,
})
}

func Benchmark_store_LazyQueryForward(b *testing.B) {
benchmarkStoreQuery(b, &logproto.QueryRequest{
Query: "{foo=\"bar\"}",
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
Query: "{foo=\"bar\"}",
Lookback: &logproto.Lookback{
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
},
Direction: logproto.FORWARD,
})
}

func Benchmark_store_LazyQueryBackward(b *testing.B) {
benchmarkStoreQuery(b, &logproto.QueryRequest{
Query: "{foo=\"bar\"}",
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
Query: "{foo=\"bar\"}",
Lookback: &logproto.Lookback{
Limit: 1000,
Start: time.Unix(0, start.UnixNano()),
End: time.Unix(0, (24*time.Hour.Nanoseconds())+start.UnixNano()),
},
Direction: logproto.BACKWARD,
})
}
Expand Down Expand Up @@ -114,7 +124,7 @@ func benchmarkStoreQuery(b *testing.B, query *logproto.QueryRequest) {
printHeap(b, false)
res = append(res, iter.Entry())
// limit result like the querier would do.
if j == query.Limit {
if j == query.Lookback.Limit {
break
}
}
Expand Down