Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
Merge branch '4.x' into THORN-2063-4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
kenfinnigan committed Jul 26, 2018
2 parents d4f0f9e + b8a5a3f commit 3ff025f
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 286 deletions.
9 changes: 7 additions & 2 deletions bom/pom.xml
Expand Up @@ -107,13 +107,14 @@
<version.smallrye.metrics>1.1.0</version.smallrye.metrics>
<version.smallrye.health>1.0.1</version.smallrye.health>
<version.smallrye.jwt>1.1.0</version.smallrye.jwt>
<version.smallrye.opentracing>1.1.0</version.smallrye.opentracing>

<version.arquillian-core>1.2.1.Final</version.arquillian-core>
<version.assertj>3.10.0</version.assertj>
<version.junit>4.12</version.junit>
<version.testng>6.9.9</version.testng>
<version.rest-assured>3.0.6</version.rest-assured>
<version.json-smart>2.3</version.json-smart>

<version.maven>3.2.5</version.maven>
<version.maven-compiler-plugin>3.7.0</version.maven-compiler-plugin>
<version.maven-failsafe-plugin>2.20.1</version.maven-failsafe-plugin>
Expand Down Expand Up @@ -819,12 +820,16 @@
<artifactId>smallrye-jwt</artifactId>
<version>${version.smallrye.jwt}</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-opentracing</artifactId>
<version>${version.smallrye.opentracing}</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-fault-tolerance</artifactId>
<version>${version.smallrye.fault-tolerance}</version>
</dependency>

<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-health</artifactId>
Expand Down
5 changes: 2 additions & 3 deletions core/jaxrs/pom.xml
Expand Up @@ -49,10 +49,9 @@
</dependency>

<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-jaxrs2</artifactId>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-opentracing</artifactId>
</dependency>

</dependencies>

</project>

This file was deleted.

@@ -0,0 +1,31 @@
package io.thorntail.jaxrs.impl.opentracing.jaxrs;

import io.opentracing.Tracer;
import io.opentracing.contrib.concurrent.TracedExecutorService;
import io.smallrye.opentracing.SmallRyeClientTracingFeature;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.enterprise.inject.spi.CDI;
import javax.ws.rs.client.ClientBuilder;
import org.eclipse.microprofile.opentracing.ClientTracingRegistrarProvider;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;

/**
* @author Pavol Loffay
*/
public class ResteasyClientTracingRegistrarProvider implements ClientTracingRegistrarProvider {

@Override
public ClientBuilder configure(ClientBuilder clientBuilder) {
// Make sure executor is the same as a default in resteasy ClientBuilder
return configure(clientBuilder, Executors.newFixedThreadPool(10));
}

@Override
public ClientBuilder configure(ClientBuilder clientBuilder, ExecutorService executorService) {
ResteasyClientBuilder resteasyClientBuilder = (ResteasyClientBuilder)clientBuilder;
Tracer tracer = CDI.current().select(Tracer.class).get();
return resteasyClientBuilder.asyncExecutor(new TracedExecutorService(executorService, tracer))
.register(new SmallRyeClientTracingFeature(tracer));
}
}

This file was deleted.

@@ -0,0 +1,24 @@
package io.thorntail.jaxrs.impl.opentracing.jaxrs;

import io.smallrye.opentracing.SmallRyeTracingDynamicFeature;
import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.container.DynamicFeature;
import javax.ws.rs.container.ResourceInfo;
import javax.ws.rs.core.FeatureContext;
import javax.ws.rs.ext.Provider;

/**
*
* @author Pavol Loffay
*/
@Provider
@ApplicationScoped
public class SmallRyeDynamicFeatureWrapper implements DynamicFeature {

private SmallRyeTracingDynamicFeature delegate = new SmallRyeTracingDynamicFeature();

@Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
this.delegate.configure(resourceInfo, context);
}
}

This file was deleted.

This file was deleted.

@@ -1,5 +1,7 @@
package io.thorntail.jaxrs.impl.opentracing.servlet;

import io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter;
import io.smallrye.opentracing.SmallRyeTracingDynamicFeature;
import java.util.EnumSet;

import javax.enterprise.context.Dependent;
Expand All @@ -14,7 +16,7 @@
import io.opentracing.Tracer;

/**
* @author Pavel Loffay
* @author Pavol Loffay
*/
@Dependent
@WebListener
Expand All @@ -23,8 +25,14 @@ public class OpenTracingContextInitializer implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
ServletContext servletContext = servletContextEvent.getServletContext();
/**
* TODO this does not work, it would be cleaner, the workaround is
* {@link io.thorntail.jaxrs.impl.opentracing.jaxrs.SmallRyeDynamicFeatureWrapper}
*/
// servletContext.setInitParameter("resteasy.providers", SmallRyeTracingDynamicFeature.class.getName());

FilterRegistration.Dynamic filterRegistration = servletContext
.addFilter("tracingFilter", new BetterSpanFinishingFilter(tracer));
.addFilter("tracingFilter", new SpanFinishingFilter(tracer));
filterRegistration.setAsyncSupported(true);
filterRegistration.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, "*");
}
Expand Down
@@ -0,0 +1 @@
io.thorntail.jaxrs.impl.opentracing.jaxrs.ResteasyClientTracingRegistrarProvider

0 comments on commit 3ff025f

Please sign in to comment.