MCPcopy Create free account
hub / github.com/cortexproject/cortex / createPRW2HTTPRequest

Function createPRW2HTTPRequest

pkg/util/push/push_test.go:148–166  ·  view source on GitHub ↗
(seriesNum int)

Source from the content-addressed store, hash-verified

146}
147
148func createPRW2HTTPRequest(seriesNum int) (*http.Request, error) {
149 series := makeV2ReqWithSeries(seriesNum)
150 protobuf, err := series.Marshal()
151 if err != nil {
152 return nil, err
153 }
154
155 body := snappy.Encode(nil, protobuf)
156 req, err := http.NewRequest("POST", "http://localhost/", newResetReader(body))
157 if err != nil {
158 return nil, err
159 }
160
161 req.Header.Add("Content-Encoding", "snappy")
162 req.Header.Set("Content-Type", appProtoV2ContentType)
163 req.Header.Set("X-Prometheus-Remote-Write-Version", remoteWriteVersion20HeaderValue)
164 req.ContentLength = int64(len(body))
165 return req, nil
166}
167
168func Benchmark_Handler(b *testing.B) {
169 var limits validation.Limits

Callers 1

Benchmark_HandlerFunction · 0.85

Calls 6

makeV2ReqWithSeriesFunction · 0.85
newResetReaderFunction · 0.85
EncodeMethod · 0.65
SetMethod · 0.65
MarshalMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected