-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22671 from radcortez/fix-22568
Copy duplicated local context to the event loop context
- Loading branch information
Showing
11 changed files
with
486 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-integration-tests-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-integration-test-opentelemetry-reactive</artifactId> | ||
<name>Quarkus - Integration Tests - OpenTelemetry Reactive</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry</artifactId> | ||
</dependency> | ||
|
||
<!-- JAX-RS --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-reactive</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-reactive-jackson</artifactId> | ||
</dependency> | ||
|
||
<!-- JAX-RS Client --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-rest-client-reactive</artifactId> | ||
</dependency> | ||
|
||
<!-- Needed for InMemorySpanExporter to verify captured traces --> | ||
<dependency> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-sdk-testing</artifactId> | ||
</dependency> | ||
|
||
<!-- Test Dependencies --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.awaitility</groupId> | ||
<artifactId>awaitility</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Minimal test dependencies to *-deployment artifacts for consistent build order --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-reactive-deployment</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-reactive-jackson-deployment</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-rest-client-reactive-deployment</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry-deployment</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>native-image</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
|
||
<properties> | ||
<quarkus.package.type>native</quarkus.package.type> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skipTests>${native.surefire.skip}</skipTests> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<native.image.path> | ||
${project.build.directory}/${project.build.finalName}-runner | ||
</native.image.path> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
49 changes: 49 additions & 0 deletions
49
...lemetry-reactive/src/main/java/io/quarkus/it/opentelemetry/reactive/ExporterResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.quarkus.it.opentelemetry.reactive; | ||
|
||
import static java.util.Comparator.comparingLong; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Response; | ||
|
||
import io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter; | ||
import io.opentelemetry.sdk.trace.data.SpanData; | ||
|
||
@Path("") | ||
public class ExporterResource { | ||
@Inject | ||
InMemorySpanExporter inMemorySpanExporter; | ||
|
||
@GET | ||
@Path("/reset") | ||
public Response reset() { | ||
inMemorySpanExporter.reset(); | ||
return Response.ok().build(); | ||
} | ||
|
||
@GET | ||
@Path("/export") | ||
public List<SpanData> export() { | ||
return inMemorySpanExporter.getFinishedSpanItems() | ||
.stream() | ||
.filter(sd -> !sd.getName().contains("export") && !sd.getName().contains("reset")) | ||
.sorted(comparingLong(SpanData::getStartEpochNanos).reversed()) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
@ApplicationScoped | ||
static class InMemorySpanExporterProducer { | ||
@Produces | ||
@Singleton | ||
InMemorySpanExporter inMemorySpanExporter() { | ||
return InMemorySpanExporter.create(); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...lemetry-reactive/src/main/java/io/quarkus/it/opentelemetry/reactive/ReactiveResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.quarkus.it.opentelemetry.reactive; | ||
|
||
import java.time.Duration; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.QueryParam; | ||
|
||
import io.opentelemetry.api.trace.Span; | ||
import io.opentelemetry.api.trace.Tracer; | ||
import io.smallrye.mutiny.Uni; | ||
|
||
@Path("/reactive") | ||
public class ReactiveResource { | ||
@Inject | ||
Tracer tracer; | ||
|
||
@GET | ||
public Uni<String> helloGet(@QueryParam("name") String name) { | ||
Span span = tracer.spanBuilder("helloGet").startSpan(); | ||
return Uni.createFrom().item("Hello " + name).onItem().delayIt().by(Duration.ofSeconds(2)) | ||
.eventually((Runnable) span::end); | ||
} | ||
|
||
@POST | ||
public Uni<String> helloPost(String body) { | ||
Span span = tracer.spanBuilder("helloPost").startSpan(); | ||
return Uni.createFrom().item("Hello " + body).onItem().delayIt().by(Duration.ofSeconds(2)) | ||
.eventually((Runnable) span::end); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...s/opentelemetry-reactive/src/main/java/io/quarkus/it/opentelemetry/reactive/SpanData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.quarkus.it.opentelemetry.reactive; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
@RegisterForReflection(classNames = { | ||
"io.opentelemetry.sdk.trace.data.SpanData", | ||
"io.opentelemetry.sdk.trace.SpanWrapper", | ||
"io.opentelemetry.sdk.trace.AutoValue_SpanWrapper", | ||
"io.opentelemetry.sdk.trace.data.StatusData", | ||
"io.opentelemetry.sdk.trace.data.ImmutableStatusData", | ||
"io.opentelemetry.sdk.trace.data.AutoValue_ImmutableStatusData", | ||
"io.opentelemetry.api.trace.SpanContext", | ||
"io.opentelemetry.api.internal.ImmutableSpanContext", | ||
"io.opentelemetry.api.internal.AutoValue_ImmutableSpanContext", | ||
"io.opentelemetry.api.trace.TraceFlags", | ||
"io.opentelemetry.api.trace.ImmutableTraceFlags", | ||
"io.opentelemetry.api.trace.TraceState", | ||
"io.opentelemetry.api.trace.ArrayBasedTraceState", | ||
"io.opentelemetry.api.trace.AutoValue_ArrayBasedTraceState", | ||
"io.opentelemetry.sdk.common.InstrumentationLibraryInfo", | ||
"io.opentelemetry.sdk.common.AutoValue_InstrumentationLibraryInfo", | ||
"io.opentelemetry.sdk.resources.Resource", | ||
"io.opentelemetry.sdk.resources.AutoValue_Resource", | ||
"io.opentelemetry.api.common.Attributes", | ||
"io.quarkus.opentelemetry.runtime.tracing.DelayedAttributes" | ||
}) | ||
public class SpanData { | ||
} |
Oops, something went wrong.