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

Promtail: do not mark the position if the file is removed #2658

Merged
merged 1 commit into from
Sep 29, 2020

Conversation

slim-bean
Copy link
Collaborator

Currently when we shutdown the tailer we always try to update the positions file, however there are 2 cases we shutdown the tailer.

  1. promtail is shutting down
  2. the file is gone and should no longer be tailed.

In this second case we are currently trying to mark the position of a file which doesn't exist and this logs an error message.

This PR adds a bool to the stop method to indicate if we are stopping because the file was removed, and if so we can skip marking the position.

…s in an error because you can't get the file size of a removed file.
@codecov-commenter
Copy link

Codecov Report

Merging #2658 into master will decrease coverage by 0.02%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2658      +/-   ##
==========================================
- Coverage   61.28%   61.26%   -0.03%     
==========================================
  Files         172      172              
  Lines       13360    13361       +1     
==========================================
- Hits         8188     8185       -3     
- Misses       4419     4429      +10     
+ Partials      753      747       -6     
Impacted Files Coverage Δ
pkg/promtail/targets/file/tailer.go 73.33% <50.00%> (+4.79%) ⬆️
pkg/promtail/targets/file/filetarget.go 66.19% <100.00%> (+2.11%) ⬆️
pkg/promtail/positions/positions.go 46.80% <0.00%> (-11.71%) ⬇️
pkg/querier/queryrange/downstreamer.go 95.29% <0.00%> (-2.36%) ⬇️
pkg/logql/evaluator.go 92.81% <0.00%> (+0.42%) ⬆️

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

@cyriltovena cyriltovena merged commit 2162a0c into master Sep 29, 2020
@cyriltovena cyriltovena deleted the quiet-error-promtail branch September 29, 2020 09:06
cyriltovena pushed a commit to cyriltovena/loki that referenced this pull request Oct 21, 2020
…s in an error because you can't get the file size of a removed file. (grafana#2658)

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
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

3 participants