Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loki: Improve logging and add metrics to streams dropped by stream limit #2012

Merged
merged 2 commits into from
Apr 29, 2020

Conversation

slim-bean
Copy link
Collaborator

I combined the two unit tests for the limiter into one and used the new more verbose error message to assert the output of the previous helper function.

Signed-off-by: Ed Welch edward.welch@grafana.com

…g a stream limit.

Increment the dropped samples metrics when this happens also.

Signed-off-by: Ed Welch <edward.welch@grafana.com>
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -10,6 +10,8 @@ const (
RateLimited = "rate_limited"
// LineTooLong is a reason for discarding too long log lines.
LineTooLong = "line_too_long"
// StreamLimit is a reason for discarding lines when we can't create any new streams
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// StreamLimit is a reason for discarding lines when we can't create any new streams
// StreamLimit is a reason for discarding lines when we can't create many new streams

localLimit = l.minNonZero(localLimit, l.convertGlobalToLocalLimit(globalLimit))
adjustedGlobalLimit := l.convertGlobalToLocalLimit(globalLimit)

// Set the calculated limit to the lessor of the local limit or the new adjusted global limit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Set the calculated limit to the lessor of the local limit or the new adjusted global limit
// Set the calculated limit to the less or of the local limit or the new adjusted global limit

Signed-off-by: Ed Welch <edward.welch@grafana.com>
@slim-bean slim-bean merged commit 0ab1b28 into master Apr 29, 2020
@slim-bean slim-bean deleted the rework-limit-log-metric branch April 29, 2020 20:50
slim-bean added a commit that referenced this pull request Apr 30, 2020
…mit (#2012)

* Improve the log message when we drop streams because a user is hitting a stream limit.
Increment the dropped samples metrics when this happens also.

Signed-off-by: Ed Welch <edward.welch@grafana.com>

* improving comments

Signed-off-by: Ed Welch <edward.welch@grafana.com>
(cherry picked from commit 0ab1b28)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants