-
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.
Merge pull request #253 from rmanibus/sentry
Sentry Exporter
- Loading branch information
Showing
25 changed files
with
1,026 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
* xref:index.adoc[Introduction] | ||
* xref:quarkus-opentelemetry-exporter-azure.adoc[Quarkus Opentelemetry Exporter for Microsoft Azure] | ||
* xref:quarkus-opentelemetry-exporter-gcp.adoc[Quarkus Opentelemetry Exporter for Google Cloud Platform] | ||
* xref:quarkus-opentelemetry-exporter-sentry.adoc[Quarkus Opentelemetry Exporter for Sentry] |
47 changes: 47 additions & 0 deletions
47
docs/modules/ROOT/pages/quarkus-opentelemetry-exporter-sentry.adoc
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,47 @@ | ||
= Quarkus Opentelemetry Exporter for Sentry | ||
|
||
include::./includes/attributes.adoc[] | ||
|
||
This exporter sends data to sentry. | ||
|
||
== General configuration | ||
|
||
Add the https://mvnrepository.com/artifact/io.quarkiverse.opentelemetry.exporter/quarkus-opentelemetry-exporter-sentry[Sentry exporter extension] to your build file. | ||
|
||
For Maven: | ||
|
||
[source,xml,subs=attributes+] | ||
---- | ||
<dependency> | ||
<groupId>io.quarkiverse.opentelemetry.exporter</groupId> | ||
<artifactId>quarkus-opentelemetry-exporter-sentry</artifactId> | ||
<version>{project-version}</version> | ||
</dependency> | ||
---- | ||
|
||
You also need a sentry project to receive the telemetry data. Go to the sentry portal, search for your project or create a new one. On the overview page of your project, you will find a DSN https://docs.sentry.io/concepts/key-terms/dsn-explainer[in the top right corner]. | ||
|
||
You can then set the dsn in your project configuration: | ||
|
||
* With the `application.properties` file | ||
|
||
[source] | ||
---- | ||
quarkus.otel.sentry.dsn=your_dsn | ||
---- | ||
|
||
* With the `QUARKUS_OTEL_SENTRY_DSN=your_dsn` environment variable | ||
|
||
|
||
Read https://quarkus.io/guides/opentelemetry#configuration-reference[this page] to learn more configuration options. | ||
|
||
== Enable more instrumentation | ||
|
||
* Read https://quarkus.io/guides/opentelemetry#jdbc[this documentation] to enable the JDBC instrumentation | ||
* Read https://quarkus.io/guides/opentelemetry#additional-instrumentation[this documentation] to enable additional instrumentations | ||
|
||
|
||
[[extension-configuration-reference]] | ||
== Extension Configuration Reference | ||
|
||
include::includes/quarkus-opentelemetry-tracer-exporter-sentry.adoc[leveloffset=+1, opts=optional] |
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,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.otel.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.otel.sentry.sentry.enabled", "true") | ||
.overrideConfigKey("quarkus.otel.sentry.dsn", "https://1234@test/1234"); | ||
|
||
@Inject | ||
OpenTelemetry openTelemetry; | ||
|
||
@Inject | ||
Instance<SpanProcessor> sentrySpanProcessorInstance; | ||
|
||
@Test | ||
void testOpenTelemetryButNoSpanProcessor() { | ||
Assertions.assertNotNull(openTelemetry); | ||
Assertions.assertTrue(sentrySpanProcessorInstance.isResolvable()); | ||
} | ||
} |
Oops, something went wrong.