Implement xpack.monitoring.elasticsearch.collection.enabled setting#33474
Conversation
|
Pinging @elastic/es-core-infra |
...rc/main/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStatsCollector.java
Outdated
Show resolved
Hide resolved
0123599 to
cd751df
Compare
pickypg
left a comment
There was a problem hiding this comment.
Some ideas on simplifying this.
...ck/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringService.java
Outdated
Show resolved
Hide resolved
...ck/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringService.java
Show resolved
Hide resolved
...rc/main/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStatsCollector.java
Outdated
Show resolved
Hide resolved
df4964a to
66c7b2e
Compare
66c7b2e to
79a79c7
Compare
| return this.elasticsearchCollectionEnabled; | ||
| } | ||
|
|
||
| public boolean shouldScheduleExecution() { |
There was a problem hiding this comment.
Should this and some of the other related methods in here be private or at least protected?
There was a problem hiding this comment.
I'd be okay with either way. I even though about package protected after I initially wrote it (so it can be tested but not reused). But you're right it doesn't need to be public.
|
@pickypg Thanks for your feedback. I've simplified the implementation per your recommendation. This is ready for review again. |
pickypg
left a comment
There was a problem hiding this comment.
Code LGTM. Just some minor doc comments.
| [source,yaml] | ||
| --------------------------------------------------- | ||
| xpack.monitoring.collection.enabled: true | ||
| xpack.monitoring.elasticsearch.collection.enabled: true |
| .. Verify that the `xpack.monitoring.enabled`, | ||
| `xpack.monitoring.collection.enabled`, and | ||
| `xpack.monitoring.elasticsearch.collection.enabled` settings are `true` on each | ||
| node in the cluster. By default, data collection is disabled. For more |
There was a problem hiding this comment.
This second sentence is very confusing with this new setting in the mix.
By default
xpack.monitoring.collection.enabledis disabled (false), and that overridesxpack.monitoring.elasticsearch.collection.enabled, which defaults to being enabled (true). Both settings can be set dynamically at runtime.
(Or similar)
| This is different from xpack.monitoring.collection.enabled, which allows you to enable or disable | ||
| all monitoring collection. However, this setting simply disables the collection of Elasticsearch | ||
| data while still allowing other data (e.g., Kibana, Logstash, Beats, or APM Server monitoring data) | ||
| to use through this cluster. |
There was a problem hiding this comment.
This is my own bad phrasing:
to use through this cluster.
should probably be
to pass through this cluster.
| } | ||
|
|
||
| public boolean isMonitoringActive() { | ||
| boolean isMonitoringActive() { |
There was a problem hiding this comment.
This one is used in the Rest endpoint to silently block incoming traffic.
…lastic#33474) * Implement xpack.monitoring.elasticsearch.collection.enabled setting * Fixing line lengths * Updating constructor calls in test * Removing unused import * Fixing line lengths in test classes * Make monitoringService.isElasticsearchCollectionEnabled() return true for tests * Remove wrong expectation * Adding unit tests for new flag to be false * Fixing line wrapping/indentation for better readability * Adding docs * Fixing logic in ClusterStatsCollector::shouldCollect * Rebasing with master and resolving conflicts * Simplifying implementation by gating scheduling * Doc fixes / improvements * Making methods package private * Fixing wording * Fixing method access
…33474) (#33791) * Implement xpack.monitoring.elasticsearch.collection.enabled setting * Fixing line lengths * Updating constructor calls in test * Removing unused import * Fixing line lengths in test classes * Make monitoringService.isElasticsearchCollectionEnabled() return true for tests * Remove wrong expectation * Adding unit tests for new flag to be false * Fixing line wrapping/indentation for better readability * Adding docs * Fixing logic in ClusterStatsCollector::shouldCollect * Rebasing with master and resolving conflicts * Simplifying implementation by gating scheduling * Doc fixes / improvements * Making methods package private * Fixing wording * Fixing method access
Resolves #33290.
This PR implements an optional setting named
xpack.monitoring.elasticsearch.collection.enabled, defaulting totrue.This setting will determine whether X-Pack Monitoring (when active overall) should collect Elasticsearch metrics or not.