BenchmarkHandleRPC_InPayload measures the per-message hot path for incoming payloads on a streaming RPC (the dominant case in QueryStream).
(b *testing.B)
| 34 | // BenchmarkHandleRPC_InPayload measures the per-message hot path for incoming |
| 35 | // payloads on a streaming RPC (the dominant case in QueryStream). |
| 36 | func BenchmarkHandleRPC_InPayload(b *testing.B) { |
| 37 | h := newBenchStatsHandler(b) |
| 38 | const method = "/cortex.Querier/QueryStream" |
| 39 | |
| 40 | // Simulate stream open: TagRPC stores the method name in ctx. |
| 41 | ctx := h.TagRPC(context.Background(), &stats.RPCTagInfo{FullMethodName: method}) |
| 42 | |
| 43 | // Simulate Begin (stream open). |
| 44 | h.HandleRPC(ctx, &stats.Begin{}) |
| 45 | |
| 46 | inPayload := &stats.InPayload{WireLength: 4096} |
| 47 | |
| 48 | b.ResetTimer() |
| 49 | b.ReportAllocs() |
| 50 | |
| 51 | for i := 0; i < b.N; i++ { |
| 52 | h.HandleRPC(ctx, inPayload) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // BenchmarkHandleRPC_OutPayload measures the per-message hot path for outgoing |
| 57 | // payloads (server-side streaming responses). |
nothing calls this directly
no test coverage detected