Skip to content

Commit

Permalink
Increase discarded samples when line is too long. (#1708)
Browse files Browse the repository at this point in the history
* Increase discarded samples when line is too long.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* Add comment on the public props

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

Co-authored-by: Joe Elliott <joe.elliott@grafana.com>
  • Loading branch information
cyriltovena and joe-elliott authored Feb 26, 2020
1 parent 6328146 commit 4fdfbe8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/distributor/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/util"
"github.com/grafana/loki/pkg/util/flagext"
"github.com/grafana/loki/pkg/util/validation"
)

type Validator struct {
Expand All @@ -38,6 +39,7 @@ func (v Validator) ValidateEntry(userID string, entry logproto.Entry) error {
// an orthogonal concept (we need not use ValidateLabels in this context)
// but the upstream cortex_validation pkg uses it, so we keep this
// for parity.
validation.DiscardedSamples.WithLabelValues(validation.LineTooLong, userID).Inc()
return httpgrpc.Errorf(
http.StatusBadRequest,
"max line size (%s) exceeded while adding (%s) size line",
Expand Down
2 changes: 2 additions & 0 deletions pkg/util/validation/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const (
// RateLimited is one of the values for the reason to discard samples.
// Declared here to avoid duplication in ingester and distributor.
RateLimited = "rate_limited"
// LineTooLong is a reason for discarding too long log lines.
LineTooLong = "line_too_long"
)

// DiscardedBytes is a metric of the total discarded bytes, by reason.
Expand Down

0 comments on commit 4fdfbe8

Please sign in to comment.