-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: fix handling of tail requests when using target all
or read
#4642
Changes from 2 commits
5122df0
bcc6938
eacd9c4
aa65db7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,6 +209,7 @@ type Loki struct { | |
// set during initialization | ||
ModuleManager *modules.Manager | ||
serviceMap map[string]services.Service | ||
deps map[string][]string | ||
|
||
Server *server.Server | ||
ring *ring.Ring | ||
|
@@ -481,7 +482,24 @@ func (t *Loki) setupModuleManager() error { | |
} | ||
} | ||
|
||
t.deps = deps | ||
t.ModuleManager = mm | ||
|
||
return nil | ||
} | ||
|
||
func (t *Loki) isModuleEnabled(m string) bool { | ||
for _, tg := range t.Cfg.Target { | ||
if tg == m { | ||
return true | ||
} | ||
if k, ok := t.deps[tg]; ok { | ||
for _, dp := range k { | ||
if dp == m { | ||
return true | ||
} | ||
} | ||
} | ||
} | ||
return false | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ohh, this is a much better check of dependencies, should we replace the function of the same name on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worried about introducing bugs as we close in on the 2.4 release so I created #4644 to track us doing this in the future. |
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.
Can we make this
isModuleActive
? We have another function with the same name on theConfig
type which behaves differently: https://github.com/grafana/loki/blob/main/pkg/loki/loki.go#L196-L198There 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.
Ideally this would be a recursive check so we could handle
IsActive(buzz) == true
whentarget=foo
edit: we should also recontribute that upstream, but I'm fine coding it here for the moment
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.
Renamed and made it recursive
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.
Just double checking: there's no chance of Loki having a cyclic dependency, right? Ex:
Because, if there is, I think it could end in an infinite loop (solution would be to track the visited modules and to not visit already visited nodes).
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.
haha, i think this could totally happen.