BenchmarkHandleRPC_StreamRoundTrip simulates a full streaming round-trip: Begin, N×(InPayload + OutPayload), End — matching QueryStream traffic.
(b *testing.B)
| 75 | // BenchmarkHandleRPC_StreamRoundTrip simulates a full streaming round-trip: |
| 76 | // Begin, N×(InPayload + OutPayload), End — matching QueryStream traffic. |
| 77 | func BenchmarkHandleRPC_StreamRoundTrip(b *testing.B) { |
| 78 | h := newBenchStatsHandler(b) |
| 79 | const method = "/cortex.Querier/QueryStream" |
| 80 | const msgsPerStream = 50 // typical number of chunks per query |
| 81 | |
| 82 | ctx := h.TagRPC(context.Background(), &stats.RPCTagInfo{FullMethodName: method}) |
| 83 | |
| 84 | inPayload := &stats.InPayload{WireLength: 512} |
| 85 | outPayload := &stats.OutPayload{WireLength: 8192} |
| 86 | |
| 87 | b.ResetTimer() |
| 88 | b.ReportAllocs() |
| 89 | |
| 90 | for i := 0; i < b.N; i++ { |
| 91 | h.HandleRPC(ctx, &stats.Begin{}) |
| 92 | for j := 0; j < msgsPerStream; j++ { |
| 93 | h.HandleRPC(ctx, inPayload) |
| 94 | h.HandleRPC(ctx, outPayload) |
| 95 | } |
| 96 | h.HandleRPC(ctx, &stats.End{}) |
| 97 | } |
| 98 | } |
nothing calls this directly
no test coverage detected