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

Function createPRW1HTTPRequest

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

Source from the content-addressed store, hash-verified

122}
123
124func createPRW1HTTPRequest(seriesNum int) (*http.Request, error) {
125 series := makeV2ReqWithSeries(seriesNum)
126 v1Req, err := convertV2RequestToV1(series, false)
127 if err != nil {
128 return nil, err
129 }
130 protobuf, err := v1Req.Marshal()
131 if err != nil {
132 return nil, err
133 }
134
135 body := snappy.Encode(nil, protobuf)
136 req, err := http.NewRequest("POST", "http://localhost/", newResetReader(body))
137 if err != nil {
138 return nil, err
139 }
140
141 req.Header.Add("Content-Encoding", "snappy")
142 req.Header.Set("Content-Type", appProtoContentType)
143 req.Header.Set("X-Prometheus-Remote-Write-Version", remoteWriteVersion1HeaderValue)
144 req.ContentLength = int64(len(body))
145 return req, nil
146}
147
148func createPRW2HTTPRequest(seriesNum int) (*http.Request, error) {
149 series := makeV2ReqWithSeries(seriesNum)

Callers 1

Benchmark_HandlerFunction · 0.85

Calls 7

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

Tested by

no test coverage detected