Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ func (i *Ingester) Push(ctx old_ctx.Context, req *client.WriteRequest) (*client.
return i.v2Push(ctx, req)
}

// Reuse the slice once done (whether the function completes successfully or errors out)
defer client.ReuseSlice(req.Timeseries)

userID, err := user.ExtractOrgID(ctx)
if err != nil {
return nil, fmt.Errorf("no user id")
Expand All @@ -314,7 +317,6 @@ func (i *Ingester) Push(ctx old_ctx.Context, req *client.WriteRequest) (*client.
return nil, err
}
}
client.ReuseSlice(req.Timeseries)

return &client.WriteResponse{}, lastPartialErr
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/ingester/ingester_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func NewV2(cfg Config, clientConfig client.Config, limits *validation.Overrides,

// v2Push adds metrics to a block
func (i *Ingester) v2Push(ctx old_ctx.Context, req *client.WriteRequest) (*client.WriteResponse, error) {
// Reuse the slice once done (whether the function completes successfully or errors out)
defer client.ReuseSlice(req.Timeseries)

userID, err := user.ExtractOrgID(ctx)
if err != nil {
return nil, fmt.Errorf("no user id")
Expand Down Expand Up @@ -101,8 +104,6 @@ func (i *Ingester) v2Push(ctx old_ctx.Context, req *client.WriteRequest) (*clien
return nil, err
}

client.ReuseSlice(req.Timeseries)

return &client.WriteResponse{}, nil
}

Expand Down