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

Update Java dependencies #903

Merged
merged 34 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5f242f8
Update spring-boot to latest version of 1.5.x branch
Sep 23, 2019
31bcf15
Add spring-boot-migrator to help with upgrade
Sep 23, 2019
f9fc50a
Update EmbeddedServlet management
Sep 23, 2019
50a0d2d
Update import for LocalPort
Sep 23, 2019
e27f11e
Update spring-boot version and temporarily upgrade mockito
Sep 23, 2019
d91c591
Mock requestFactory on restTemplate
Sep 24, 2019
a85811e
Fix imports for io.micrometer which now is included in spring-boot
Sep 24, 2019
62fa5d5
Remove no longer needed packages
Sep 24, 2019
2dfd76e
Add new config properties to expose /prometheus endpoint
Sep 25, 2019
fbb7449
Explicitly enable scheduled methods
Sep 25, 2019
8bdf396
Fix annotation typo
Sep 25, 2019
1a99a65
prometheus is already enabled by default
Sep 25, 2019
255eed1
Update to spring-boot@v2.1.8
Sep 25, 2019
cc323fa
Update jackson components to 2.9.10
Sep 25, 2019
8c2d6c1
Update io.kubernetes:client-java to v4.0
Sep 25, 2019
3afccfb
Update io.kubernetes:client-java to v5.0
Sep 25, 2019
e83928b
Update io.kubernetes:client-java to v6.0.1
Sep 25, 2019
36d0bfb
Update gRPC version to v1.23.0
Sep 25, 2019
ef9be20
Update com.google.guava to v28.1-jre
Sep 26, 2019
1c9ad1f
Refactor protobuf version into ${pb.version} variable and update to v…
Sep 26, 2019
f728663
Update jaeger-client to v1.0.0
Sep 26, 2019
ca924ca
Update opentracing-grpc to v0.2.0 and opentracing-spring-web to v2.1.3
Sep 26, 2019
2215aea
Rename and change signature of TracingServerInterceptor and TracingCl…
Sep 26, 2019
ae68bf0
Span no longer finish automatically on Scope closing
Sep 26, 2019
31cec35
Finish Span on REST requests
Sep 26, 2019
d8179ea
Make dependency on opentracing-api explicit
Oct 7, 2019
b4170ef
Activate span within current scope
Oct 7, 2019
28fc76a
Add test mocking TracingProvider
Oct 7, 2019
01667dd
Update ojalgo to v47.3.1
Oct 8, 2019
9b8211a
Move Apache Curator version to variable and update to v4.2.0
Oct 8, 2019
a33a47f
Don't use netty.utils.internal.ConcurrentHashMap and use instead java…
Oct 8, 2019
20f53f1
Update commons-lang3 to v3.9
Oct 8, 2019
01c9ede
Update httpclient to v4.5.8
Oct 8, 2019
27d9cf4
Update to latest micrometer-registry-prometheus LTS v1.1.7
Oct 8, 2019
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
64 changes: 39 additions & 25 deletions engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.17.RELEASE</version>
<version>2.1.8.RELEASE</version>
</parent>

<groupId>io.seldon.engine</groupId>
Expand All @@ -19,10 +19,14 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<grpc.version>1.14.0</grpc.version>
<micrometer.version>1.1.0</micrometer.version>
<grpc.version>1.23.0</grpc.version>
<pb.version>3.9.2</pb.version>
<micrometer.version>1.1.7</micrometer.version>
<start-class>io.seldon.engine.App</start-class>
<jaeger.version>0.32.0</jaeger.version>
<jaeger.version>1.0.0</jaeger.version>
<opentracing.version>0.33.0</opentracing.version>
<curator.version>4.2.0</curator.version>
<jackson.version>2.9.10</jackson.version>
</properties>

<build>
Expand Down Expand Up @@ -136,7 +140,7 @@
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.1.0:exe:${os.detected.classifier}</protocArtifact>
<protocArtifact>com.google.protobuf:protoc:${pb.version}:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
<clearOutputDirectory>false</clearOutputDirectory>
Expand Down Expand Up @@ -174,7 +178,7 @@
<dependency>
<groupId>org.ojalgo</groupId>
<artifactId>ojalgo</artifactId>
<version>47.0.0</version>
<version>47.3.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -187,10 +191,26 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-mock</artifactId>
<version>${opentracing.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>${opentracing.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
Expand All @@ -199,28 +219,28 @@
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>2.7.1</version>
<version>${curator.version}</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>2.7.1</version>
<version>${curator.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.9</version>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.9</version>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.9</version>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
Expand All @@ -231,7 +251,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -248,7 +268,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
<version>4.5.8</version>
</dependency>


Expand All @@ -271,29 +291,23 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.2.0</version>
<version>${pb.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.2.0rc2</version>
<version>${pb.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>22.0</version>
<version>28.1-jre</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-spring-legacy</artifactId>
<version>${micrometer.version}</version>
</dependency>

<dependency>
<groupId>io.micrometer</groupId>
Expand All @@ -304,7 +318,7 @@
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java</artifactId>
<version>3.0.0</version>
<version>6.0.1</version>
<scope>compile</scope>
</dependency>

Expand All @@ -317,13 +331,13 @@
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-grpc</artifactId>
<version>0.0.10</version>
<version>0.2.0</version>
</dependency>

<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-web</artifactId>
<version>0.3.4</version>
<version>2.1.3</version>
</dependency>
</dependencies>
</project>
23 changes: 10 additions & 13 deletions engine/src/main/java/io/seldon/engine/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import io.seldon.engine.config.AppConfig;

@SpringBootApplication
@EnableAsync
@EnableScheduling
@Import({ AppConfig.class })
public class App {
public static void main(String[] args) throws Exception {
Expand All @@ -50,16 +52,11 @@ public GracefulShutdown gracefulShutdown() {
}

@Bean
public EmbeddedServletContainerCustomizer tomcatCustomizer() {
return new EmbeddedServletContainerCustomizer() {

public WebServerFactoryCustomizer tomcatCustomizer() {
return new WebServerFactoryCustomizer<TomcatServletWebServerFactory>() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
if (container instanceof TomcatEmbeddedServletContainerFactory) {
adriangonz marked this conversation as resolved.
Show resolved Hide resolved
((TomcatEmbeddedServletContainerFactory) container)
.addConnectorCustomizers(gracefulShutdown());
}

public void customize(TomcatServletWebServerFactory factory) {
factory.addConnectorCustomizers(gracefulShutdown());
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,27 @@
*******************************************************************************/
package io.seldon.engine.api.rest;

import com.google.protobuf.InvalidProtocolBufferException;

import io.micrometer.core.annotation.Timed;

import io.opentracing.Span;
import io.opentracing.Tracer;

import java.io.IOException;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;

import javax.annotation.PostConstruct;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
Expand All @@ -37,10 +45,6 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.google.protobuf.InvalidProtocolBufferException;

import io.micrometer.core.annotation.Timed;
import io.opentracing.Scope;
import io.seldon.engine.exception.APIException;
import io.seldon.engine.exception.APIException.ApiExceptionType;
import io.seldon.engine.pb.ProtoBufUtils;
Expand Down Expand Up @@ -137,17 +141,20 @@ String unpause() {
public ResponseEntity<String> predictions_json(RequestEntity<String> requestEntity)
{
logger.debug("Received predict request");
Scope tracingScope = null;
if (tracingProvider.isActive())
tracingScope = tracingProvider.getTracer().buildSpan("/api/v0.1/predictions").startActive(true);
Span tracingSpan = null;
if (tracingProvider.isActive()) {
Tracer tracer = tracingProvider.getTracer();
tracingSpan = tracer.buildSpan("/api/v0.1/predictions").start();
tracer.scopeManager().activate(tracingSpan);
}
try
{
return _predictions(requestEntity.getBody());
}
finally
{
if (tracingScope != null)
tracingScope.close();
if (tracingSpan != null)
tracingSpan.finish();
}

}
Expand All @@ -159,9 +166,12 @@ public ResponseEntity<String> predictions_json(RequestEntity<String> requestEnti
public ResponseEntity<String> predictions_multiform(MultipartHttpServletRequest requestEntity)
{
logger.debug("Received predict request");
Scope tracingScope = null;
if (tracingProvider.isActive())
tracingScope = tracingProvider.getTracer().buildSpan("/api/v0.1/predictions").startActive(true);
Span tracingSpan = null;
if (tracingProvider.isActive()) {
Tracer tracer = tracingProvider.getTracer();
tracingSpan = tracer.buildSpan("/api/v0.1/predictions").start();
tracer.scopeManager().activate(tracingSpan);
}
try {
ObjectMapper mapper = new ObjectMapper();
Map<String,Object> mergedParamMap = new HashMap<String,Object>();
Expand Down Expand Up @@ -191,8 +201,8 @@ public ResponseEntity<String> predictions_multiform(MultipartHttpServletRequest

} finally
{
if (tracingScope != null)
tracingScope.close();
if (tracingSpan != null)
tracingSpan.finish();
}

}
Expand Down Expand Up @@ -244,9 +254,12 @@ private ResponseEntity<String> _predictions(String json)
@RequestMapping(value= "/api/v0.1/feedback", method = RequestMethod.POST, consumes = "application/json; charset=utf-8", produces = "application/json; charset=utf-8")
public ResponseEntity<String> feedback(RequestEntity<String> requestEntity) {
logger.debug("Received feedback request");
Scope tracingScope = null;
if (tracingProvider.isActive())
tracingScope = tracingProvider.getTracer().buildSpan("/api/v0.1/feedback").startActive(true);
Span tracingSpan = null;
if (tracingProvider.isActive()) {
Tracer tracer = tracingProvider.getTracer();
tracingSpan = tracer.buildSpan("/api/v0.1/feedback").start();
tracer.scopeManager().activate(tracingSpan);
}
try
{
Feedback feedback;
Expand Down Expand Up @@ -284,8 +297,8 @@ public ResponseEntity<String> feedback(RequestEntity<String> requestEntity) {
}
finally
{
if (tracingScope != null)
tracingScope.close();
if (tracingSpan != null)
tracingSpan.finish();
}

}
Expand Down
4 changes: 2 additions & 2 deletions engine/src/main/java/io/seldon/engine/config/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package io.seldon.engine.config;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;

Expand All @@ -26,7 +26,7 @@ public class AppConfig {

@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public EmbeddedServletContainerCustomizer containerCustomizer() {
public WebServerFactoryCustomizer containerCustomizer() {
return new CustomizationBean();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;

public class CustomizationBean implements EmbeddedServletContainerCustomizer {
public class CustomizationBean implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {

private final static Logger logger = LoggerFactory.getLogger(CustomizationBean.class);
private final static String ENGINE_SERVER_PORT_KEY = "ENGINE_SERVER_PORT";
Expand All @@ -30,7 +30,7 @@ public class CustomizationBean implements EmbeddedServletContainerCustomizer {
private Integer defaultServerPort;

@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
public void customize(ConfigurableServletWebServerFactory factory) {
logger.info("Customizing EmbeddedServlet");

Integer serverPort;
Expand All @@ -46,7 +46,7 @@ public void customize(ConfigurableEmbeddedServletContainer container) {
}

logger.info("setting serverPort[{}]", serverPort);
container.setPort(serverPort);
factory.setPort(serverPort);
}

}
Loading