runPRW2HandleFromPool simulates handlePRW2 using the sync.Pool
(ctx context.Context, body []byte, contentLength int, overrides *validation.Overrides, userID string)
| 236 | |
| 237 | // runPRW2HandleFromPool simulates handlePRW2 using the sync.Pool |
| 238 | func runPRW2HandleFromPool(ctx context.Context, body []byte, contentLength int, overrides *validation.Overrides, userID string) error { |
| 239 | req := cortexpb.PreallocWriteRequestV2FromPool() |
| 240 | defer cortexpb.ReuseWriteRequestV2(req) |
| 241 | |
| 242 | if err := util.ParseProtoReader(ctx, bytes.NewReader(body), contentLength, benchMaxRecvMsgSize, req, util.RawSnappy); err != nil { |
| 243 | return err |
| 244 | } |
| 245 | _, err := convertV2RequestToV1(req, overrides.EnableTypeAndUnitLabels(userID)) |
| 246 | return err |
| 247 | } |
| 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 { |
no test coverage detected