runPRW2HandleFromScratch simulates handlePRW2 without using the sync.Pool.
(ctx context.Context, body []byte, contentLength int, overrides *validation.Overrides, userID string)
| 248 | |
| 249 | // runPRW2HandleFromScratch simulates handlePRW2 without using the sync.Pool. |
| 250 | func runPRW2HandleFromScratch(ctx context.Context, body []byte, contentLength int, overrides *validation.Overrides, userID string) error { |
| 251 | var req cortexpb.PreallocWriteRequestV2 |
| 252 | defer cortexpb.ReuseWriteRequestV2(&req) |
| 253 | |
| 254 | if err := util.ParseProtoReader(ctx, bytes.NewReader(body), contentLength, benchMaxRecvMsgSize, &req, util.RawSnappy); err != nil { |
| 255 | return err |
| 256 | } |
| 257 | _, err := convertV2RequestToV1(&req, overrides.EnableTypeAndUnitLabels(userID)) |
| 258 | return err |
| 259 | } |
| 260 | |
| 261 | // Benchmark_HandlePRW2_PoolVsScratch compares two allocation strategies for the PRW2 parse path. |
| 262 | // - pool: req := cortexpb.PreallocWriteRequestV2FromPool() + defer ReuseWriteRequestV2(req) |
no test coverage detected