-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
883 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.quarkiverse.opentelemetry.exporter</groupId> | ||
<artifactId>quarkus-opentelemetry-exporter-sentry-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-opentelemetry-exporter-sentry-deployment</artifactId> | ||
<name>Quarkus Opentelemetry Exporter Sentry - Deployment</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkiverse.opentelemetry.exporter</groupId> | ||
<artifactId>quarkus-opentelemetry-exporter-sentry</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.sentry</groupId> | ||
<artifactId>sentry-opentelemetry-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5-internal</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> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${assertj-core.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
65 changes: 65 additions & 0 deletions
65
...rc/main/java/io/quarkiverse/opentelemetry/exporter/sentry/deployment/SentryProcessor.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,65 @@ | ||
package io.quarkiverse.opentelemetry.exporter.sentry.deployment; | ||
|
||
import static io.quarkus.deployment.Capability.REST; | ||
import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT; | ||
|
||
import java.util.function.BooleanSupplier; | ||
|
||
import io.quarkiverse.opentelemetry.exporter.sentry.beans.SentrySpanProcessorProducer; | ||
import io.quarkiverse.opentelemetry.exporter.sentry.config.SentryConfig; | ||
import io.quarkiverse.opentelemetry.exporter.sentry.config.SentryConfig.SentryExporterRuntimeConfig; | ||
import io.quarkiverse.opentelemetry.exporter.sentry.filters.SentryFilter; | ||
import io.quarkiverse.opentelemetry.exporter.sentry.recorders.SentryRecorder; | ||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.deployment.Capabilities; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.BuildSteps; | ||
import io.quarkus.deployment.annotations.Record; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
import io.quarkus.deployment.builditem.LogHandlerBuildItem; | ||
import io.quarkus.opentelemetry.deployment.exporter.otlp.ExternalOtelExporterBuildItem; | ||
|
||
@BuildSteps(onlyIf = SentryProcessor.SentryExporterEnabled.class) | ||
public final class SentryProcessor { | ||
|
||
static class SentryExporterEnabled implements BooleanSupplier { | ||
SentryConfig.SentryExporterBuildConfig sentryExporterConfig; | ||
|
||
public boolean getAsBoolean() { | ||
return sentryExporterConfig.enabled(); | ||
} | ||
} | ||
|
||
private static final String FEATURE = "sentry"; | ||
|
||
@BuildStep | ||
FeatureBuildItem feature() { | ||
return new FeatureBuildItem(FEATURE); | ||
} | ||
|
||
@BuildStep | ||
void registerExternalExporter(BuildProducer<ExternalOtelExporterBuildItem> buildProducer) { | ||
buildProducer.produce(new ExternalOtelExporterBuildItem("sentry")); | ||
} | ||
|
||
@BuildStep | ||
@Record(RUNTIME_INIT) | ||
LogHandlerBuildItem addSentryHandler(final SentryExporterRuntimeConfig config, final SentryRecorder recorder) { | ||
return new LogHandlerBuildItem(recorder.create(config)); | ||
} | ||
|
||
@BuildStep | ||
void additionalBeanSentryFilter(Capabilities capabilities, BuildProducer<AdditionalBeanBuildItem> producer) { | ||
if (!capabilities.isPresent(REST)) { | ||
return; | ||
} | ||
producer.produce(AdditionalBeanBuildItem.builder().addBeanClass(SentryFilter.class).build()); | ||
} | ||
|
||
@BuildStep | ||
AdditionalBeanBuildItem additionalBeanProducers() { | ||
return AdditionalBeanBuildItem.builder() | ||
.addBeanClass(SentrySpanProcessorProducer.class).build(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...a/io/quarkiverse/opentelemetry/exporter/sentry/deployment/SentryExporterDisabledTest.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,32 @@ | ||
package io.quarkiverse.opentelemetry.exporter.sentry.deployment; | ||
|
||
import jakarta.enterprise.inject.Instance; | ||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.sentry.opentelemetry.SentrySpanProcessor; | ||
|
||
public class SentryExporterDisabledTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withEmptyApplication() | ||
.overrideConfigKey("quarkus.opentelemetry.tracer.exporter.sentry.enabled", "false"); | ||
|
||
@Inject | ||
OpenTelemetry openTelemetry; | ||
|
||
@Inject | ||
Instance<SentrySpanProcessor> sentrySpanProcessorInstance; | ||
|
||
@Test | ||
void testOpenTelemetryButNoSpanProcessor() { | ||
Assertions.assertNotNull(openTelemetry); | ||
Assertions.assertFalse(sentrySpanProcessorInstance.isResolvable()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...va/io/quarkiverse/opentelemetry/exporter/sentry/deployment/SentryExporterEnabledTest.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.quarkiverse.opentelemetry.exporter.sentry.deployment; | ||
|
||
import jakarta.enterprise.inject.Instance; | ||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.sdk.trace.SpanProcessor; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class SentryExporterEnabledTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withEmptyApplication() | ||
.overrideConfigKey("quarkus.opentelemetry.tracer.exporter.sentry.enabled", "true") | ||
.overrideConfigKey("quarkus.opentelemetry.tracer.exporter.sentry.dsn", "https://1234@test/1234"); | ||
|
||
@Inject | ||
OpenTelemetry openTelemetry; | ||
|
||
@Inject | ||
Instance<SpanProcessor> sentrySpanProcessorInstance; | ||
|
||
@Test | ||
void testOpenTelemetryButNoSpanProcessor() { | ||
Assertions.assertNotNull(openTelemetry); | ||
Assertions.assertTrue(sentrySpanProcessorInstance.isResolvable()); | ||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
quarkus-opentelemetry-exporter-sentry/integration-tests/pom.xml
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,122 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkiverse.opentelemetry.exporter</groupId> | ||
<artifactId>quarkus-opentelemetry-exporter-sentry-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-opentelemetry-exporter-sentry-integration-tests</artifactId> | ||
<name>Quarkus Opentelemetry Exporter Sentry - Integration Tests</name> | ||
|
||
<properties> | ||
<skipITs>true</skipITs> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-jackson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.opentelemetry.exporter</groupId> | ||
<artifactId>quarkus-opentelemetry-exporter-sentry</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<!-- TESTS --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>${testcontainers-junit-jupiter.version}</version> | ||
<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> | ||
<dependency> | ||
<groupId>io.quarkiverse.wiremock</groupId> | ||
<artifactId>quarkus-wiremock-test</artifactId> | ||
<version>${quarkus-wiremock-test.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>${assertj-core.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</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> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>native-image</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skipTests>${native.surefire.skip}</skipTests> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<properties> | ||
<skipITs>false</skipITs> | ||
<quarkus.package.type>native</quarkus.package.type> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</project> |
59 changes: 59 additions & 0 deletions
59
...egration-tests/src/main/java/io/quarkiverse/opentelemetry/exporter/it/SimpleResource.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,59 @@ | ||
package io.quarkiverse.opentelemetry.exporter.it; | ||
|
||
import jakarta.inject.Inject; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.PathParam; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
@Path("") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public class SimpleResource { | ||
|
||
@Inject | ||
TracedService tracedService; | ||
|
||
@GET | ||
public TraceData noPath() { | ||
TraceData data = new TraceData(); | ||
data.message = "No path trace"; | ||
return data; | ||
} | ||
|
||
@GET | ||
@Path("/direct") | ||
public TraceData directTrace() { | ||
TraceData data = new TraceData(); | ||
data.message = "Direct trace"; | ||
|
||
return data; | ||
} | ||
|
||
@GET | ||
@Path("/chained") | ||
public TraceData chainedTrace() { | ||
TraceData data = new TraceData(); | ||
data.message = tracedService.call(); | ||
|
||
return data; | ||
} | ||
|
||
@GET | ||
@Path("/deep/path") | ||
public TraceData deepUrlPathTrace() { | ||
TraceData data = new TraceData(); | ||
data.message = "Deep url path"; | ||
|
||
return data; | ||
} | ||
|
||
@GET | ||
@Path("/param/{paramId}") | ||
public TraceData pathParameters(@PathParam("paramId") String paramId) { | ||
TraceData data = new TraceData(); | ||
data.message = "ParameterId: " + paramId; | ||
|
||
return data; | ||
} | ||
} |
Oops, something went wrong.