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

Add count to 'loki_ingester_memory_chunks' when recovery from wal #4272

Merged
merged 1 commit into from
Sep 28, 2021
Merged
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
1 change: 1 addition & 0 deletions pkg/ingester/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func (r *ingesterRecoverer) Series(series *Series) error {
if err != nil {
return err
}
memoryChunks.Add(float64(len(series.Chunks)))
r.ing.metrics.recoveredChunksTotal.Add(float64(len(series.Chunks)))
r.ing.metrics.recoveredEntriesTotal.Add(float64(entriesAdded))
r.ing.replayController.Add(int64(bytesAdded))
Expand Down
6 changes: 3 additions & 3 deletions pkg/ingester/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ func (s *stream) Push(
}
}()
}
}

if len(s.chunks) != prevNumChunks {
memoryChunks.Add(float64(len(s.chunks) - prevNumChunks))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code should be executed before the failure handling because some chunks may be stored in memory even if others is failed

Copy link
Member

Choose a reason for hiding this comment

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

Great catch!


if len(failedEntriesWithError) > 0 {
Expand Down Expand Up @@ -345,9 +348,6 @@ func (s *stream) Push(
return bytesAdded, httpgrpc.Errorf(statusCode, buf.String())
}

if len(s.chunks) != prevNumChunks {
memoryChunks.Add(float64(len(s.chunks) - prevNumChunks))
}
return bytesAdded, nil
}

Expand Down