Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Commit 88fdab9

Browse files
authored
Add PA plugin support for ElasticSearch v7.4.2 (#80)
1 parent 59d26f6 commit 88fdab9

File tree

9 files changed

+47
-27
lines changed

9 files changed

+47
-27
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
buildscript {
1717

1818
ext {
19-
es_version = System.getProperty("es.version", "7.3.2")
19+
es_version = System.getProperty("es.version", "7.4.2")
2020
}
2121
// This isn't applying from repositories.gradle so repeating it here
2222
repositories {
@@ -34,7 +34,7 @@ plugins {
3434
}
3535

3636
ext {
37-
opendistroVersion = '1.3.0'
37+
opendistroVersion = '1.4.0'
3838
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
3939
}
4040

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

release-notes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Version 1.4.0 (Version compatible with elasticsearch 7.4.2)
2+
## New Features
3+
This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.4.2
4+
15
## Version 1.3.0 (Version compatible with elasticsearch 7.3.2)
26
## New Features
37
This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.3.2

src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/PerformanceAnalyzerPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public List<org.elasticsearch.rest.RestHandler> getRestHandlers(final Settings s
186186
final SettingsFilter settingsFilter,
187187
final IndexNameExpressionResolver indexNameExpressionResolver,
188188
final Supplier<DiscoveryNodes> nodesInCluster) {
189-
PerformanceAnalyzerConfigAction performanceanalyzerConfigAction = new PerformanceAnalyzerConfigAction(settings, restController);
189+
PerformanceAnalyzerConfigAction performanceanalyzerConfigAction = new PerformanceAnalyzerConfigAction(restController);
190190
PerformanceAnalyzerConfigAction.setInstance(performanceanalyzerConfigAction);
191191
return singletonList(performanceanalyzerConfigAction);
192192
}

src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/NodeStatsMetricsCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void collectMetrics(long startTime) {
152152
return;
153153
}
154154

155-
NodeIndicesStats nodeIndicesStats = indicesService.stats(true, CommonStatsFlags.ALL);
155+
NodeIndicesStats nodeIndicesStats = indicesService.stats(CommonStatsFlags.ALL);
156156

157157
HashSet<ShardId> currentShards = new HashSet<>();
158158

src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/http_action/config/PerformanceAnalyzerConfigAction.java

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,27 @@
1515

1616
package com.amazon.opendistro.elasticsearch.performanceanalyzer.http_action.config;
1717

18+
import com.amazon.opendistro.elasticsearch.performanceanalyzer.ConfigStatus;
19+
import com.amazon.opendistro.elasticsearch.performanceanalyzer.ESResources;
1820
import com.amazon.opendistro.elasticsearch.performanceanalyzer.PerformanceAnalyzerPlugin;
19-
import org.elasticsearch.rest.BaseRestHandler;
20-
import org.elasticsearch.rest.RestController;
21-
import org.elasticsearch.rest.RestRequest;
22-
import org.elasticsearch.rest.RestStatus;
23-
import org.elasticsearch.common.settings.Settings;
24-
import org.elasticsearch.client.node.NodeClient;
25-
26-
import org.elasticsearch.common.xcontent.XContentBuilder;
27-
import org.elasticsearch.common.xcontent.XContentHelper;
28-
import org.elasticsearch.rest.BytesRestResponse;
29-
21+
import java.io.File;
3022
import java.io.IOException;
31-
import java.nio.file.Path;
32-
import java.util.Map;
3323
import java.nio.file.Files;
24+
import java.nio.file.Path;
3425
import java.nio.file.Paths;
35-
import java.io.File;
26+
import java.util.Map;
3627
import java.util.Scanner;
37-
3828
import org.apache.logging.log4j.LogManager;
3929
import org.apache.logging.log4j.Logger;
40-
41-
import com.amazon.opendistro.elasticsearch.performanceanalyzer.ConfigStatus;
42-
import com.amazon.opendistro.elasticsearch.performanceanalyzer.ESResources;
30+
import org.elasticsearch.client.node.NodeClient;
4331
import org.elasticsearch.common.inject.Inject;
32+
import org.elasticsearch.common.xcontent.XContentBuilder;
33+
import org.elasticsearch.common.xcontent.XContentHelper;
34+
import org.elasticsearch.rest.BaseRestHandler;
35+
import org.elasticsearch.rest.BytesRestResponse;
36+
import org.elasticsearch.rest.RestController;
37+
import org.elasticsearch.rest.RestRequest;
38+
import org.elasticsearch.rest.RestStatus;
4439

4540
@SuppressWarnings("deprecation")
4641
public class PerformanceAnalyzerConfigAction extends BaseRestHandler {
@@ -61,8 +56,8 @@ public static void setInstance(PerformanceAnalyzerConfigAction performanceanalyz
6156

6257
private static final String METRIC_ENABLED_CONF_FILENAME = "performance_analyzer_enabled.conf";
6358
@Inject
64-
public PerformanceAnalyzerConfigAction(Settings settings, RestController controller) {
65-
super(settings);
59+
public PerformanceAnalyzerConfigAction(RestController controller) {
60+
super();
6661
controller.registerHandler(org.elasticsearch.rest.RestRequest.Method.GET, "/_opendistro/_performanceanalyzer/config", this);
6762
controller.registerHandler(org.elasticsearch.rest.RestRequest.Method.POST, "/_opendistro/_performanceanalyzer/config", this);
6863
this.featureEnabled = getFeatureEnabledFromConf();

src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/http_action/whoami/TransportWhoAmIAction.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
package com.amazon.opendistro.elasticsearch.performanceanalyzer.http_action.whoami;
1717

1818
import com.amazon.opendistro.elasticsearch.performanceanalyzer.ESResources;
19-
2019
import org.elasticsearch.action.ActionListener;
2120
import org.elasticsearch.action.support.ActionFilters;
2221
import org.elasticsearch.action.support.HandledTransportAction;
2322
import org.elasticsearch.common.inject.Inject;
24-
import org.elasticsearch.transport.TransportService;
2523
import org.elasticsearch.indices.IndicesService;
2624
import org.elasticsearch.tasks.Task;
25+
import org.elasticsearch.transport.TransportService;
2726

2827
public class TransportWhoAmIAction extends HandledTransportAction<WhoAmIRequest, WhoAmIResponse> {
2928

src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/http_action/whoami/WhoAmIRequest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@
1616
package com.amazon.opendistro.elasticsearch.performanceanalyzer.http_action.whoami;
1717

1818
import org.elasticsearch.action.support.nodes.BaseNodesRequest;
19+
import org.elasticsearch.common.io.stream.StreamInput;
1920

2021
public class WhoAmIRequest extends BaseNodesRequest<WhoAmIRequest> {
22+
23+
private static final String[] EMPTY_NODE_ID_ARRAY = {};
24+
25+
public WhoAmIRequest() {
26+
this(null);
27+
}
28+
29+
public WhoAmIRequest(StreamInput input) {
30+
// Adding a ctor which matches the FunctionalInterface Writable.Reader<> so that ctor
31+
// reference succeeds.
32+
// The ctor itself calls the BaseNodesRequest<>(String... nodeIds) ctor with empty string
33+
// array(same functionality as 7.3.2's default ctor) since it was removed in 7.4.2.
34+
super(EMPTY_NODE_ID_ARRAY);
35+
}
2136
}

src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/http_action/whoami/WhoAmIResponse.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.io.IOException;
1919

2020
import org.elasticsearch.action.ActionResponse;
21+
import org.elasticsearch.common.io.stream.StreamOutput;
2122
import org.elasticsearch.common.xcontent.ToXContent;
2223
import org.elasticsearch.common.xcontent.XContentBuilder;
2324

@@ -28,4 +29,10 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
2829
builder.endObject();
2930
return builder;
3031
}
32+
33+
@Override
34+
public void writeTo(StreamOutput out) throws IOException {
35+
// This is a no-op call just like how it was in 7.3.2(inherited from TransportMessage
36+
// .writeTo)
37+
}
3138
}

0 commit comments

Comments
 (0)