Skip to content

Commit a682812

Browse files
committed
Undo a spurious change in push handler
The meaning of the code as-was is that we initialise to `API` but allow the unmarshal code to override. Tests were added in #2457 to confirm this works as expected. Signed-off-by: Bryan Boreham <[email protected]>
1 parent 88400e1 commit a682812

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pkg/util/push/push.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ func Handler(cfg distributor.Config, push func(context.Context, *client.WriteReq
1717
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
1818
compressionType := util.CompressionTypeFor(r.Header.Get("X-Prometheus-Remote-Write-Version"))
1919
var req client.PreallocWriteRequest
20+
req.Source = client.API
2021
_, err := util.ParseProtoReader(r.Context(), r.Body, int(r.ContentLength), cfg.MaxRecvMsgSize, &req, compressionType)
2122
logger := util.WithContext(r.Context(), util.Logger)
2223
if err != nil {
2324
level.Error(logger).Log("err", err.Error())
2425
http.Error(w, err.Error(), http.StatusBadRequest)
2526
return
2627
}
27-
if req.Source == 0 {
28-
req.Source = client.API
29-
}
3028

3129
if _, err := push(r.Context(), &req.WriteRequest); err != nil {
3230
resp, ok := httpgrpc.HTTPResponseFromError(err)

0 commit comments

Comments
 (0)