[7.x] Add action to decommission legacy monitoring cluster alerts (#64373)#66309
Merged
jbaiera merged 2 commits intoelastic:7.xfrom Dec 15, 2020
Merged
[7.x] Add action to decommission legacy monitoring cluster alerts (#64373)#66309jbaiera merged 2 commits intoelastic:7.xfrom
jbaiera merged 2 commits intoelastic:7.xfrom
Conversation
…64373) Adds an action that will proactively remove any watches that monitoring has configured. The action toggles on a new setting that informs the cluster to tear down any previously created cluster alerts, and after that is accepted, the action immediately attempts a best-effort refresh of cluster alert resources in order to force their removal in case collection is disabled or delayed. Since resources are controlled lazily by the existing monitoring exporters, extra care was taken to ensure that any in-flight resource management operations do not race against any resource actions taken by the migration action. Resource installation code was updated with callbacks to report any errors instead of just logging them. # Conflicts: # x-pack/plugin/monitoring/src/internalClusterTest/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java # x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java # x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java
jbaiera
commented
Dec 15, 2020
Comment on lines
+68
to
+80
| @Override | ||
| protected Collection<Class<? extends Plugin>> transportClientPlugins() { | ||
| return Arrays.asList(LocalStateMonitoring.class, MockClusterAlertScriptEngine.TestPlugin.class, | ||
| MockIngestPlugin.class, CommonAnalysisPlugin.class); | ||
| } | ||
|
|
||
| @Override | ||
| protected Settings transportClientSettings() { | ||
| return Settings.builder().put(super.transportClientSettings()) | ||
| .put(XPackSettings.SECURITY_ENABLED.getKey(), false) | ||
| .put(XPackSettings.WATCHER_ENABLED.getKey(), false) | ||
| .build(); | ||
| } |
Member
Author
There was a problem hiding this comment.
These were added:
- To disable security in the tests. The tests were failing because security expects the Transport client type to be a secure one, but the tests install the mock-nio client.
- To mirror the test plugins here in
transportClientPluginsso that the client in the test has the watcher and monitoring actions available on it.
Contributor
There was a problem hiding this comment.
are MockIngestPlugin.class, CommonAnalysisPlugin.class needed ?
Member
Author
There was a problem hiding this comment.
Nope! I took them off, along with MockClusterAlertScriptEngine.TestPlugin.class
jbaiera
commented
Dec 15, 2020
Comment on lines
+57
to
+63
|
|
||
| @Override | ||
| public Collection<Module> createGuiceModules() { | ||
| return XPackPlugin.transportClientMode(settings) ? | ||
| Collections.emptyList() : | ||
| super.createGuiceModules(); | ||
| } |
Member
Author
There was a problem hiding this comment.
Added in order to ignore watcher's feature set object which expects a client to be injected. When creating a transport client, these feature set objects are created at some point and there are no clients available to the injector to give their constructors. This results in a Guice exception.
jakelandis
approved these changes
Dec 15, 2020
Contributor
jakelandis
left a comment
There was a problem hiding this comment.
LGTM (minor question if a test plugins are needed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports the following commits to 7.x: