support v2 proto for BenchmarkSampleSend

Signed-off-by: Callum Styan <callumstyan@gmail.com>
This commit is contained in:
Callum Styan 2024-09-18 10:59:21 -07:00
parent b6107cc888
commit 161b79c75e

View file

@ -1326,21 +1326,25 @@ func BenchmarkSampleSend(b *testing.B) {
cfg.MaxShards = 20 cfg.MaxShards = 20
// todo: test with new proto type(s) // todo: test with new proto type(s)
m := newTestQueueManager(b, cfg, mcfg, defaultFlushDeadline, c, config.RemoteWriteProtoMsgV1) for _, format := range []config.RemoteWriteProtoMsg{config.RemoteWriteProtoMsgV1, config.RemoteWriteProtoMsgV2} {
m.StoreSeries(series, 0) b.Run(string(format), func(b *testing.B) {
m := newTestQueueManager(b, cfg, mcfg, defaultFlushDeadline, c, format)
m.StoreSeries(series, 0)
// These should be received by the client. // These should be received by the client.
m.Start() m.Start()
defer m.Stop() defer m.Stop()
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
m.Append(samples) m.Append(samples)
m.UpdateSeriesSegment(series, i+1) // simulate what wlog.Watcher.garbageCollectSeries does m.UpdateSeriesSegment(series, i+1) // simulate what wlog.Watcher.garbageCollectSeries does
m.SeriesReset(i + 1) m.SeriesReset(i + 1)
}
// Do not include shutdown
b.StopTimer()
})
} }
// Do not include shutdown
b.StopTimer()
} }
// Check how long it takes to add N series, including external labels processing. // Check how long it takes to add N series, including external labels processing.