-
Notifications
You must be signed in to change notification settings - Fork 487
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
Integrations always running regardless of enabled flag #689
Changes from 1 commit
c9e476b
afa2eee
cce8999
6808da7
22f1d16
cd058b4
e7b90a7
0f9ca9c
bb362da
d752a4f
b7f0e68
a60942a
98895c0
8c4c896
f90f44a
7b1987f
411ccde
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 |
---|---|---|
|
@@ -205,6 +205,8 @@ func (m *Manager) ApplyConfig(cfg ManagerConfig) error { | |
// No-op | ||
} | ||
|
||
// Before applying any configurations, remove them from the array if enabled = false | ||
|
||
// Iterate over our integrations. New or changed integrations will be | ||
// started, with their existing counterparts being shut down. | ||
for _, ic := range cfg.Integrations { | ||
|
@@ -220,9 +222,14 @@ func (m *Manager) ApplyConfig(cfg ManagerConfig) error { | |
continue | ||
} | ||
p.stop() | ||
m.im.DeleteConfig(key) | ||
delete(m.integrations, key) | ||
} | ||
|
||
if !ic.CommonConfig().Enabled { | ||
continue | ||
} | ||
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. I still think a function to return a slice of enabled integrations would be easier to follow than having to maintain this check across the two loops, IMO. 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. We still need the integrations in the array to disable/remove them, ie going from enabled -> disabled on reload. 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. Looks like this is in here twice :) |
||
|
||
l := log.With(m.logger, "integration", ic.Name()) | ||
i, err := ic.NewIntegration(l) | ||
if err != nil { | ||
|
@@ -258,6 +265,10 @@ func (m *Manager) ApplyConfig(cfg ManagerConfig) error { | |
foundConfig := false | ||
for _, ic := range cfg.Integrations { | ||
if integrationKey(ic.Name()) == key { | ||
// If this is disabled then we should delete from integrations | ||
if !ic.CommonConfig().Enabled { | ||
break | ||
} | ||
foundConfig = true | ||
break | ||
} | ||
|
@@ -268,6 +279,7 @@ func (m *Manager) ApplyConfig(cfg ManagerConfig) error { | |
|
||
_ = m.im.DeleteConfig(key) | ||
process.stop() | ||
m.im.DeleteConfig(key) | ||
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. Why do we need to call this twice? 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. Not at all and removed. |
||
delete(m.integrations, key) | ||
} | ||
|
||
|
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.
Beforehand the scraper was not stopping, but the integration was.
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'm not following how this is necessary, the second loop should be deleting the config?
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.
With the addition of the enabled check around line 227 the integration process is not started so the integration isn't added to the to m.integrations.