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

Commit

Permalink
Merge pull request #65 from ktkrg/opendistro-1.2
Browse files Browse the repository at this point in the history
Merging OpenDistro-1.2 into master
  • Loading branch information
ktkrg authored Jul 24, 2019
2 parents af0a1a0 + 30dc250 commit f161118
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 47 deletions.
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
buildscript {

ext {
es_version = System.getProperty("es.version", "6.7.1")
es_version = System.getProperty("es.version", "7.2.0")
}
// This isn't applying from repositories.gradle so repeating it here
repositories {
Expand All @@ -34,7 +34,7 @@ plugins {
}

ext {
opendistroVersion = '0.9.0'
opendistroVersion = '1.2.0'
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
}

Expand Down Expand Up @@ -146,7 +146,6 @@ dependencyLicenses.doFirst {
integTestRunner {
// add "-Dtests.security.manager=false" to VM options if you want to run integ tests in IntelliJ
systemProperty 'tests.security.manager', 'false'
ifNoTests 'ignore'
}

bundlePlugin {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 12 additions & 0 deletions release-notes
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## Version 1.2.0 (Version compatible with elasticsearch 7.2.0)
## New Features
This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.2.0

## Version 1.1.0 (Version compatible with elasticsearch 7.1.1)
## New Features
This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.1.1

## Version 1.0.0 (Version compatible with elasticsearch 7.0.1)
## New Features
This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.0.1

## Version 0.9.0 (Version compatible with elasticsearch 6.7.1)
## New Features
This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 6.7.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,23 @@
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.tasks.Task;

public class TransportWhoAmIAction extends HandledTransportAction<WhoAmIRequest, WhoAmIResponse> {

@Inject
public TransportWhoAmIAction(final Settings settings, final ThreadPool threadPool,
final TransportService transportService, final ActionFilters actionFilters,
final IndexNameExpressionResolver indexNameExpressionResolver, final IndicesService indicesService) {
super(settings, WhoAmIAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, WhoAmIRequest::new);
public TransportWhoAmIAction(final TransportService transportService,
final ActionFilters actionFilters,
final IndicesService indicesService) {
super(WhoAmIAction.NAME, transportService, actionFilters, WhoAmIRequest::new);
ESResources.INSTANCE.setIndicesService(indicesService);
}

@Override
protected void doExecute(WhoAmIRequest request, ActionListener<WhoAmIResponse> listener) {
protected void doExecute(Task task, WhoAmIRequest request, ActionListener<WhoAmIResponse> listener) {
listener.onResponse(new WhoAmIResponse());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
package com.amazon.opendistro.elasticsearch.performanceanalyzer.http_action.whoami;

import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;

public class WhoAmIAction extends Action<WhoAmIRequest, WhoAmIResponse, WhoAmIRequestBuilder> {
public class WhoAmIAction extends Action<WhoAmIResponse> {

public static final WhoAmIAction INSTANCE = new WhoAmIAction();
public static final String NAME = "cluster:admin/performanceanalyzer/whoami";
Expand All @@ -27,14 +26,8 @@ protected WhoAmIAction() {
super(NAME);
}

@Override
public WhoAmIRequestBuilder newRequestBuilder(final ElasticsearchClient client) {
return new WhoAmIRequestBuilder(client, this);
}

@Override
public WhoAmIResponse newResponse() {
return new WhoAmIResponse();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;

public class WhoAmIRequestBuilder extends ActionRequestBuilder<WhoAmIRequest, WhoAmIResponse, WhoAmIRequestBuilder> {
public class WhoAmIRequestBuilder extends ActionRequestBuilder<WhoAmIRequest, WhoAmIResponse> {
public WhoAmIRequestBuilder(final ClusterAdminClient client) {
this(client, WhoAmIAction.INSTANCE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public static String getCurrentTimeMetric() {
}

public static String generatePath(long startTime, String... keysPath) {
Path sDevShmLocationPath = Paths.get(sDevShmLocation).resolve(Paths.get(String.valueOf(PerformanceAnalyzerMetrics.getTimeInterval(startTime)), keysPath));
Path sDevShmLocationPath = Paths.get(sDevShmLocation)
.resolve(Paths.get(String.valueOf(PerformanceAnalyzerMetrics.getTimeInterval(startTime)), keysPath));
return sDevShmLocationPath.toString();
}

Expand Down Expand Up @@ -163,7 +164,7 @@ private static File writeToTmp(String keyPath, String value) throws Exception {
}

public static String getMetric(long startTime, String... keysPath) {
return getMetric(generatePath(startTime, keysPath));
return getMetric(generatePath(startTime, keysPath));
}

public static String getMetric(String keyPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,26 @@
import java.util.Map;
import java.util.Set;

import javax.net.ssl.HttpsURLConnection;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.apache.logging.log4j.util.Supplier;

import org.jooq.Record;
import org.jooq.Result;

import com.amazon.opendistro.elasticsearch.performanceanalyzer.PerformanceAnalyzerApp;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.StatExceptionCode;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.StatsCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.config.PluginSettings;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.metricsdb.MetricsDB;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.model.MetricAttributes;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.model.MetricsModel;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.reader.ClusterLevelMetricsReader;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.reader.ReaderMetricsProcessor;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.util.JsonConverter;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.StatsCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.StatExceptionCode;

import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import javax.net.ssl.HttpsURLConnection;

/**
* Request handler that supports querying MetricsDB on every EC2 instance.
Expand Down Expand Up @@ -188,9 +185,10 @@ public boolean validParams(HttpExchange exchange, List<String> metricList, List<
}
}
}
for (String agg : aggList) {
for (String agg : aggList) {
if (!MetricsDB.AGG_VALUES.contains(agg)) {
sendResponse(exchange, String.format("{\"error\":\"%s is an invalid aggregation type.\"}", agg), HttpURLConnection.HTTP_BAD_REQUEST);
sendResponse(exchange, String.format("{\"error\":\"%s is an invalid aggregation type.\"}", agg),
HttpURLConnection.HTTP_BAD_REQUEST);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,4 @@ private TransportChannel getShardBulkChannel(T request, TransportChannel channel

return performanceanalyzerChannel;
}

@Override
public void messageReceived(T request, TransportChannel channel) throws Exception {
messageReceived(request, channel, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,24 @@


package com.amazon.opendistro.elasticsearch.performanceanalyzer.metrics;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.config.PluginSettings;

import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.Before;
import static org.mockito.Mockito.when;
import org.mockito.Mock;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.junit.runner.RunWith;
import org.powermock.modules.junit4.PowerMockRunner;

@PowerMockIgnore({ "org.apache.logging.log4j.*" })
import com.amazon.opendistro.elasticsearch.performanceanalyzer.config.PluginSettings;
import static org.junit.Assert.assertEquals;

@PowerMockIgnore({"org.apache.logging.log4j.*"})
@RunWith(PowerMockRunner.class)
@PrepareForTest({ PerformanceAnalyzerMetrics.class, PluginSettings.class })
@SuppressStaticInitializationFor({ "PluginSettings" })
@PrepareForTest({PerformanceAnalyzerMetrics.class, PluginSettings.class})
@SuppressStaticInitializationFor({"PluginSettings"})
public class PerformanceAnalyzerMetricsTests {

@Before
Expand All @@ -59,7 +58,8 @@ public void testBasicMetric() {
public void testGeneratePath() {
long startTimeInMillis = 1553725339;
String generatedPath = PerformanceAnalyzerMetrics.generatePath(startTimeInMillis, "dir1", "id", "dir2");
String expectedPath = PerformanceAnalyzerMetrics.sDevShmLocation + "/" + String.valueOf(PerformanceAnalyzerMetrics.getTimeInterval(startTimeInMillis)) + "/dir1/id/dir2";
String expectedPath = PerformanceAnalyzerMetrics.sDevShmLocation +
"/" + PerformanceAnalyzerMetrics.getTimeInterval(startTimeInMillis) + "/dir1/id/dir2";
assertEquals(expectedPath, generatedPath);
}
}

0 comments on commit f161118

Please sign in to comment.