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] resolve issue with promtail not scraping target if only path changed in a simpler way that dont need mutex to sync threads #4599

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

rsteneteg
Copy link
Contributor

resolve issue with promtail not scraping target if only path changed in a simpler way that dont need mutex to sync threads

Signed-off-by: Roger Steneteg rsteneteg@ea.com

What this PR does / why we need it:
Resolves an issue in a better way, that don't require sharing variables between theads that would require a mutex to synchronize goroutines.

Which issue(s) this PR fixes:
Fixes #4581 #4460

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated

…in a simpler way that dont need mutex to sync threads

Signed-off-by: Roger Steneteg <rsteneteg@ea.com>
@rsteneteg rsteneteg requested a review from a team as a code owner October 30, 2021 02:23
level.Debug(s.log).Log("msg", "ignoring target, already exists", "labels", labels.String())
s.metrics.failedTargets.WithLabelValues("exists").Inc()
}
if _, ok := s.targets[key]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not an promtail expert. Leave it @slim-bean for the final approval.

I still do think we need some tests to lock this behaviour!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that be great.

@cyriltovena
Copy link
Contributor

@slim-bean should we merge ?

Copy link
Collaborator

@slim-bean slim-bean left a comment

Choose a reason for hiding this comment

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

LGTM!

@slim-bean slim-bean merged commit 3b66d94 into grafana:main Nov 3, 2021
Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

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

Just had a chance to look at this. Looks great, thank you!

@Mario-Hofstaetter
Copy link
Contributor

@rsteneteg may I ask if this PR is going to fix #3698 also? I fear it does not.
I could test on the weekend with a main build whether this changes the behavior.

@rsteneteg
Copy link
Contributor Author

@Mario-Hofstaetter it looks like this change would also fix #3698, since the path variable is used within the key it would no longer be seen as a duplicate and ignored.

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.

Promtail may fail to scrape pods if the only label that changes is the filename
6 participants