-
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
Targets not required in promtail config #2026
Targets not required in promtail config #2026
Conversation
@slim-bean Does this change has any impact on docker driver and any other module? I am not aware of other uses of this. Hope this change doesn't break anything |
eb59543
to
40fd630
Compare
40fd630
to
6181cb6
Compare
for i, tg := range cfg.ServiceDiscoveryConfig.StaticConfigs { | ||
tg.Source = fmt.Sprintf("%d", i) | ||
if !(len(tg.Targets) > 0) { |
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(tg.Targets) > 0) { | |
if len(tg.Targets) == 0 { |
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.
Perfect. Thanks @owen-d
6181cb6
to
94f71ce
Compare
Codecov Report
@@ Coverage Diff @@
## master #2026 +/- ##
=======================================
Coverage 63.82% 63.82%
=======================================
Files 133 133
Lines 10208 10211 +3
=======================================
+ Hits 6515 6517 +2
- Misses 3204 3206 +2
+ Partials 489 488 -1
|
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.
Thanks for the PR. Everything looks good, but I'm not informed enough on this part of the project to know if we want this change.
I have a few questions:
- Why do we assign
dummy
? These must belocalhost
in all cases as promtail can only scrape a file system. - Do we want this shortcut? Is it worth the confusion of having identical-behaving configs, one which uses
targets
and one which omits it?
Part of me thinks we could make the case for removing the targets
field entirely b/c it's not relevant to promtail. However this would create difficulties trying to copy/paste prometheus service discovery code into promtail.
@cyriltovena suggested silently omitting this and removing targets
from the docs, which would keep compatibility while minimizing confusion in many cases.
@slim-bean Can you weigh in?
@owen-d We don't have to name it Also, I am completely for "removing this(targets) silently from the docs". Just that it should not confuse the existing users.
Agree on this but I think users will eventually get adjusted to this |
…s will be more intuitive for people, also re-worded the docs a bit. Signed-off-by: Ed Welch <edward.welch@grafana.com>
Wanted to get this into the 1.5 RC so I inserted my opinions via I think using I also re-worded the docs a bit. |
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.
I ran this locally with and without targets and it LGTM!
Thank you @slim-bean |
What this PR does / why we need it:
Targets are not required in promtail config. If defined in config we will just use that otherwise we will just add
dummy
host.Which issue(s) this PR fixes:
Fixes #1929
Checklist