Skip to content
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

[AMBARI-26142] JDK17 support for Ambari-metrics #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ambari.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 8
java-version: 17
distribution: temurin
cache: maven
- name: Install Kerberos development libraries
Expand Down
2 changes: 1 addition & 1 deletion ambari-metrics-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@
<data>
<src>${collector.dir}/target/lib</src>
<type>directory</type>
<includes>phoenix*.jar,antlr*.jar,re2j*.jar,failureaccess*.jar,guava-28*.jar,stax2-api*.jar,woodstox-core*.jar,hadoop-annotations*.jar,hadoop-auth*.jar,hadoop-common*.jar,commons-configuration2*.jar,hadoop-yarn-api-*.jar,hadoop-yarn-client-*.jar,hadoop-yarn-common-*.jar,hadoop-yarn-registry-*.jar,hadoop-yarn-server-applicationhistoryservice-*.jar,hadoop-yarn-server-common-*.jar,hadoop-yarn-server-nodemanager-*.jar,hadoop-yarn-server-resourcemanager-*.jar,hadoop-yarn-server-timelineservice-*.jar,hadoop-yarn-server-web-proxy-*.jar</includes>
<includes>phoenix*.jar,antlr*.jar,re2j*.jar,failureaccess*.jar,guava-32*.jar,stax2-api*.jar,woodstox-core*.jar,hadoop-annotations*.jar,hadoop-auth*.jar,hadoop-common*.jar,commons-configuration2*.jar,hadoop-yarn-api-*.jar,hadoop-yarn-client-*.jar,hadoop-yarn-common-*.jar,hadoop-yarn-registry-*.jar,hadoop-yarn-server-applicationhistoryservice-*.jar,hadoop-yarn-server-common-*.jar,hadoop-yarn-server-nodemanager-*.jar,hadoop-yarn-server-resourcemanager-*.jar,hadoop-yarn-server-timelineservice-*.jar,hadoop-yarn-server-web-proxy-*.jar</includes>
<mapper>
<type>perm</type>
<filemode>644</filemode>
Expand Down
11 changes: 8 additions & 3 deletions ambari-metrics-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.5</version>
</plugin>
<plugin>
<groupId>org.vafer</groupId>
Expand All @@ -56,7 +56,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<version>3.5.1</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
Expand Down Expand Up @@ -103,7 +103,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.0-jre</version>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
Expand Down Expand Up @@ -156,6 +156,11 @@
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions ambari-metrics-flume-sink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ limitations under the License.
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.5</version>
</plugin>
<plugin>
<groupId>com.github.goldin</groupId>
Expand Down Expand Up @@ -141,7 +141,7 @@ limitations under the License.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
<version>32.1.3-jre</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion ambari-metrics-hadoop-sink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ limitations under the License.
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.5</version>
</plugin>
<plugin>
<groupId>com.github.goldin</groupId>
Expand Down
4 changes: 2 additions & 2 deletions ambari-metrics-host-aggregator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<groupId>org.apache.ambari</groupId>
Expand Down Expand Up @@ -145,7 +145,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<version>3.5.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import org.junit.Test;


import javax.ws.rs.core.MediaType;

import java.util.Collection;
import java.util.Map;

import static org.junit.Assert.assertEquals;


public class AggregatorWebServiceTest extends JerseyTest {

public AggregatorWebServiceTest() {
super(new WebAppDescriptor.Builder(
"org.apache.hadoop.metrics2.host.aggregator")
Expand Down Expand Up @@ -74,11 +72,9 @@ public void testWrongPath() {
assertEquals(404, response.getStatus());
}


@Test
public void testMetricsPost() {
TimelineMetricsHolder timelineMetricsHolder = TimelineMetricsHolder.getInstance();

timelineMetricsHolder.extractMetricsForAggregationPublishing();
timelineMetricsHolder.extractMetricsForRawPublishing();

Expand Down
2 changes: 1 addition & 1 deletion ambari-metrics-host-monitoring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down
2 changes: 1 addition & 1 deletion ambari-metrics-kafka-sink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ limitations under the License.
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.5</version>
</plugin>
<plugin>
<groupId>com.github.goldin</groupId>
Expand Down
4 changes: 2 additions & 2 deletions ambari-metrics-storm-sink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ limitations under the License.
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.5</version>
</plugin>
<plugin>
<groupId>com.github.goldin</groupId>
Expand All @@ -54,7 +54,7 @@ limitations under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
11 changes: 8 additions & 3 deletions ambari-metrics-timelineservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -216,7 +216,6 @@
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<forkMode>always</forkMode>
<argLine>-XX:-UseSplitVerifier</argLine>
<!-- Each profile in the top-level pom.xml defines which test group categories to run. -->
<groups>${testcase.groups}</groups>
</configuration>
Expand Down Expand Up @@ -524,7 +523,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.0-jre</version>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
Expand Down Expand Up @@ -664,6 +663,12 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-server-applicationhistoryservice</artifactId>
<version>${hadoop.version}</version>
</dependency>

<!-- 'mvn dependency:analyze' fails to detect use of this dependency -->
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
import org.apache.ambari.metrics.core.timeline.TestTimelineMetricStore;
import org.apache.ambari.metrics.core.timeline.TimelineMetricStore;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider;

import org.junit.Test;

import com.google.inject.Guice;
Expand Down Expand Up @@ -75,24 +77,24 @@ protected Injector getInjector() {

public TestTimelineWebServices() {
super(new WebAppDescriptor.Builder(
"org.apache.ambari.metrics.webapp")
.contextListenerClass(GuiceServletConfig.class)
.filterClass(com.google.inject.servlet.GuiceFilter.class)
.contextPath("jersey-guice-filter")
.servletPath("/")
.clientConfig(new DefaultClientConfig(YarnJacksonJaxbJsonProvider.class))
.build());
"org.apache.ambari.metrics.webapp")
.contextListenerClass(GuiceServletConfig.class)
.filterClass(com.google.inject.servlet.GuiceFilter.class)
.contextPath("jersey-guice-filter")
.servletPath("/")
.clientConfig(new DefaultClientConfig(YarnJacksonJaxbJsonProvider.class))
.build());
}

@Test
public void testAbout() throws Exception {
WebResource r = resource();
ClientResponse response = r.path("ws").path("v1").path("timeline")
.accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
.accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
TimelineWebServices.AboutInfo about =
response.getEntity(TimelineWebServices.AboutInfo.class);
response.getEntity(TimelineWebServices.AboutInfo.class);
Assert.assertNotNull(about);
Assert.assertEquals("AMS API", about.getAbout());
}
Expand All @@ -109,9 +111,9 @@ private static void verifyMetrics(TimelineMetrics metrics) {
public void testGetMetrics() throws Exception {
WebResource r = resource();
ClientResponse response = r.path("ws").path("v1").path("timeline")
.path("metrics").queryParam("metricNames", "cpu_user").queryParam("precision", "seconds")
.accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
.path("metrics").queryParam("metricNames", "cpu_user").queryParam("precision", "seconds")
.accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
verifyMetrics(response.getEntity(TimelineMetrics.class));
}
Expand Down
22 changes: 17 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<distMgmtStagingUrl>https://repository.apache.org/service/local/staging/deploy/maven2</distMgmtStagingUrl>
<fasterxml.jackson.version>2.10.0</fasterxml.jackson.version>
<skipPythonTests>false</skipPythonTests>
<jersey.version>2.41</jersey.version>
<release.version>1</release.version>
</properties>
<distributionManagement>
Expand Down Expand Up @@ -133,7 +134,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.0-jre</version>
<version>32.1.3-jre</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -169,20 +170,31 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<version>3.2.5</version>
<configuration>
<skip>${skipSurefireTests}</skip>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.management/java.lang.management=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.nio=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.util.regex=ALL-UNNAMED
--add-opens java.base/java.util.concurrent=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
</argLine>

<!-- Each profile in the top-level pom.xml defines which test group categories to run. -->
<groups>${testcase.groups}</groups>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.5</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
Expand Down
Loading