-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Implement xpack.monitoring.elasticsearch.collection.enabled setting #33474
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
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.
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
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this and some of the other related methods in here be private or at least protected?
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'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. |
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.
Code LGTM. Just some minor doc comments.
[source,yaml] | ||
--------------------------------------------------- | ||
xpack.monitoring.collection.enabled: true | ||
xpack.monitoring.elasticsearch.collection.enabled: true |
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.
This should be false
.
.. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This second sentence is very confusing with this new setting in the mix.
By default
xpack.monitoring.collection.enabled
is 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my own bad phrasing:
to use through this cluster.
should probably be
to pass through this cluster.
@@ -122,15 +122,15 @@ public TimeValue getInterval() { | |||
return interval; | |||
} | |||
|
|||
public boolean isMonitoringActive() { | |||
boolean isMonitoringActive() { |
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.
This one is used in the Rest endpoint to silently block incoming traffic.
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!
…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.