Skip to content

Commit 71cd889

Browse files
Enable profiling plugin by default (#92787)
Originally the profiling plugin required to set `search.max_buckets` to a higher value than the current default. Had we enabled the profiling plugin by default, we would have changed the default value of that setting for all clusters implicitly. Due to a different bootstrapping process of the profiling solution, we do not require to change any settings anymore in the plugin. With this commit we therefore enable the plugin by default. Relates #91640
1 parent a536143 commit 71cd889

File tree

3 files changed

+6
-32
lines changed

3 files changed

+6
-32
lines changed

docs/changelog/92787.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 92787
2+
summary: Enable profiling plugin by default
3+
area: Search
4+
type: enhancement
5+
issues: []

x-pack/plugin/profiler/src/internalClusterTest/java/org/elasticsearch/xpack/profiler/ProfilingTestCase.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
3333
protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
3434
return Settings.builder()
3535
.put(super.nodeSettings(nodeOrdinal, otherSettings))
36-
.put(ProfilingPlugin.PROFILING_ENABLED.getKey(), true)
3736
.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty4Plugin.NETTY_TRANSPORT_NAME)
3837
.put(NetworkModule.HTTP_TYPE_KEY, Netty4Plugin.NETTY_HTTP_TRANSPORT_NAME)
3938
.build();

x-pack/plugin/profiler/src/main/java/org/elasticsearch/xpack/profiler/ProfilingPlugin.java

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.elasticsearch.rest.RestController;
3131
import org.elasticsearch.rest.RestHandler;
3232
import org.elasticsearch.script.ScriptService;
33-
import org.elasticsearch.search.aggregations.MultiBucketConsumerService;
3433
import org.elasticsearch.threadpool.ThreadPool;
3534
import org.elasticsearch.tracing.Tracer;
3635
import org.elasticsearch.watcher.ResourceWatcherService;
@@ -39,7 +38,6 @@
3938
import java.util.Collection;
4039
import java.util.Collections;
4140
import java.util.List;
42-
import java.util.Locale;
4341
import java.util.function.Supplier;
4442

4543
import static java.util.Collections.singletonList;
@@ -48,15 +46,12 @@ public class ProfilingPlugin extends Plugin implements ActionPlugin {
4846
private static final Logger logger = LogManager.getLogger(ProfilingPlugin.class);
4947
public static final Setting<Boolean> PROFILING_ENABLED = Setting.boolSetting(
5048
"xpack.profiling.enabled",
51-
false,
49+
true,
5250
Setting.Property.NodeScope
5351
);
54-
private static final int REQUIRED_MAX_BUCKETS = 150_000;
55-
private final Settings settings;
5652
private final boolean enabled;
5753

5854
public ProfilingPlugin(Settings settings) {
59-
this.settings = settings;
6055
this.enabled = PROFILING_ENABLED.get(settings);
6156
}
6257

@@ -116,31 +111,6 @@ public List<Setting<?>> getSettings() {
116111
return List.of(PROFILING_ENABLED);
117112
}
118113

119-
@Override
120-
public Settings additionalSettings() {
121-
// workaround until https://github.com/elastic/elasticsearch/issues/91776 is implemented
122-
final Settings.Builder builder = Settings.builder();
123-
if (enabled) {
124-
if (MultiBucketConsumerService.MAX_BUCKET_SETTING.exists(settings) == false) {
125-
logger.debug("Overriding [{}] to [{}].", MultiBucketConsumerService.MAX_BUCKET_SETTING, REQUIRED_MAX_BUCKETS);
126-
builder.put(MultiBucketConsumerService.MAX_BUCKET_SETTING.getKey(), REQUIRED_MAX_BUCKETS);
127-
} else {
128-
Integer configuredMaxBuckets = MultiBucketConsumerService.MAX_BUCKET_SETTING.get(settings);
129-
if (configuredMaxBuckets != null && configuredMaxBuckets < REQUIRED_MAX_BUCKETS) {
130-
final String message = String.format(
131-
Locale.ROOT,
132-
"Profiling requires [%s] to be set at least to [%d] but was configured to [%d].",
133-
MultiBucketConsumerService.MAX_BUCKET_SETTING.getKey(),
134-
REQUIRED_MAX_BUCKETS,
135-
configuredMaxBuckets
136-
);
137-
throw new IllegalArgumentException(message);
138-
}
139-
}
140-
}
141-
return builder.build();
142-
}
143-
144114
@Override
145115
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
146116
return List.of(new ActionHandler<>(GetProfilingAction.INSTANCE, TransportGetProfilingAction.class));

0 commit comments

Comments
 (0)