-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Clean up config checks / fix heartbeat NPE #11165
Conversation
Pinging @elastic/uptime |
m1, m1Err := makeTestMon() | ||
assert.NoError(t, m1Err) | ||
require.NoError(t, m1Err) |
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.
These are now require because subsequent assertions make no sense if prior ones fail.
7d0bc02
to
c62d376
Compare
This also fixes a libbeat bug where the dynamic config reloading code would start the runners specified in the factory as part of the check, but never stop them. This uses the proper I tried adding a test for this, but the code is quite hard to mock and stub. It probably needs a refactor beyond the scope of this PR to become more testable. |
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 like the implementation with the Unsafe and Check config.
This will also need a changelog entry.
@ruflin should be ready for another pass, I think I've addressed all your concerns. |
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.
CI failure looks related.
heartbeat/monitors/factory.go
Outdated
} | ||
}() | ||
|
||
if err != nil { |
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.
Use just return err
, no additional check needed.
ab19dd9
to
b277a43
Compare
b277a43
to
409af72
Compare
I like this change as it is it removes the non implemented methods and allows Heartbeat to move forward with the interface. |
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.
Overall change LGTM. You will need to rebase, and can you also add a changelog entry?
@ruflin fixed merge conflicts, updated the issue description / title (so that it will make a better commit message) and added a changelog entry. Can I get a final LGTM? |
jenkins, test this |
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.
LGTM. I like the solution that was found here and I hope we didn't miss any side effects.
There are 3 files in vendor directory which changed in this PR which I think shouldn't ...
@@ -4,7 +4,6 @@ package tlsconfig | |||
|
|||
import ( | |||
"crypto/x509" |
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.
How did these vendor changes slip in here? Also see below.
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.
Fixed via a new squashed commit. Something weird was going on with git, but squashing fixed it. I couldn't remove them in subsequent commits weirdly.
2da47d0
to
a93aa27
Compare
@andrewvc The travis build was failing for Heartbeat, but I don't think related at all. I restarted it . |
Merging. Failures are unrelated. Metricbeat tests keep failing for different reasons. Out of three tries, two for package management servers being down. |
This fixes a bug where heartbeat would encounter an NPE while attempting to free resources during a config check and cleans up some internal interfaces. This change lets beats choose whether their factories implement a special config check function. If not, it is assumed their creation function will return an error and that this can be used for checking the config. It is further assumed that creation with the factory is fully GC-able, which is not the case for heartbeat, hence the need for a custom CheckConfig method. (cherry picked from commit dcce078)
This fixes a bug where heartbeat would encounter an NPE while attempting to free resources during a config check and cleans up some internal interfaces. This change lets beats choose whether their factories implement a special config check function. If not, it is assumed their creation function will return an error and that this can be used for checking the config. It is further assumed that creation with the factory is fully GC-able, which is not the case for heartbeat, hence the need for a custom CheckConfig method. (cherry picked from commit dcce078)
This fixes a bug where heartbeat would encounter an NPE while attempting to free resources during a config check and cleans up some internal interfaces. This change lets beats choose whether their factories implement a special config check function. If not, it is assumed their creation function will return an error and that this can be used for checking the config. It is further assumed that creation with the factory is fully GC-able, which is not the case for heartbeat, hence the need for a custom CheckConfig method. (cherry picked from commit dcce078)
This fixes a bug where heartbeat would encounter an NPE while attempting to free resources during a config check and cleans up some internal interfaces.
This change lets beats choose whether their factories implement a special config check function. If not, it is assumed their creation function will return an error and that this can be used for checking the config. It is further assumed that creation with the factory is fully GC-able, which is not the case for heartbeat, hence the need for a custom
CheckConfig
method.