-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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: Log a crude lag metric for how far behind a client is. #3236
Conversation
…ry and the current time as a crude measure of how far behind a promtail instance is.
for _, s := range req.Streams { | ||
streamLabelsSize += int64(len(s.Labels)) | ||
for _, e := range s.Entries { | ||
totalEntries++ | ||
entriesSize += int64(len(e.Line)) | ||
if e.Timestamp.After(mostRecentEntry) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just look at the last entry for each stream instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(s.Entries) > 0 {
last := s.Entries[len(s.Entries)-1].Timestamp
if last.Timestamp.After(mostRecentEntry) {
mostRecentEntry = last
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if/when we support out of order the current implementation would handle that a little better but I agree this is a better optimization for our current constraints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Log the difference in time between the most recently received log entry and the current time as a crude measure of how far behind a client instance is.