Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix the error message
  • Loading branch information
ravishankar15 committed Nov 29, 2024
commit 49588ce5a914e6daef622cfc919565b6398f9400
2 changes: 1 addition & 1 deletion pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func (d *Distributor) Push(ctx context.Context, req *logproto.PushRequest) (*log

// Return early if request does not contain any streams
if len(req.Streams) == 0 {
return &logproto.PushResponse{}, httpgrpc.Errorf(http.StatusUnprocessableEntity, validation.MissingStreams)
return &logproto.PushResponse{}, httpgrpc.Errorf(http.StatusUnprocessableEntity, validation.MissingStreamsErrorMsg)
}

// First we flatten out the request into a list of samples.
Expand Down
4 changes: 2 additions & 2 deletions pkg/distributor/distributor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,10 @@ func Test_DiscardEmptyStreamsAfterValidation(t *testing.T) {

t.Run("it returns unprocessable entity error if the streams is empty", func(t *testing.T) {
limits, ingester := setup()
distributors, _ := prepare(t, 1, 5, limits, func(addr string) (ring_client.PoolClient, error) { return ingester, nil })
distributors, _ := prepare(t, 1, 5, limits, func(_ string) (ring_client.PoolClient, error) { return ingester, nil })

_, err := distributors[0].Push(ctx, makeWriteRequestWithLabels(1, 1, []string{}))
require.Equal(t, err, httpgrpc.Errorf(http.StatusUnprocessableEntity, validation.MissingStreams))
require.Equal(t, err, httpgrpc.Errorf(http.StatusUnprocessableEntity, validation.MissingStreamsErrorMsg))
topVal := ingester.Peek()
require.Nil(t, topVal)
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/validation/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
)

const (
ReasonLabel = "reason"
MissingStreams = "error at least one valid stream is required for ingestion"
ReasonLabel = "reason"
MissingStreamsErrorMsg = "error at least one valid stream is required for ingestion"

// InvalidLabels is a reason for discarding log lines which have labels that cannot be parsed.
InvalidLabels = "invalid_labels"
Expand Down
Loading