forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds an extension to provide on OTLP/HTTP exporter as described here https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md#otlphttp and as implemented by the OpenTelemetry SDK. This as an alternative to the standard OTLP/gRPC exporter. Fixes quarkusio#21535
- Loading branch information
1 parent
d675300
commit 57d39e9
Showing
15 changed files
with
561 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
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
66 changes: 66 additions & 0 deletions
66
extensions/opentelemetry/opentelemetry-exporter-otlp-http/deployment/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,66 @@ | ||
<?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.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry-exporter-otlp-http-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-opentelemetry-exporter-otlp-http-deployment</artifactId> | ||
<name>Quarkus - OpenTelemetry Exporter - OTLP/HTTP - Deployment</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry-exporter-otlp-http</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry-deployment</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> | ||
<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>${project.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
45 changes: 45 additions & 0 deletions
45
...ava/io/quarkus/opentelemetry/exporter/otlp/http/deployment/OtlpHttpExporterProcessor.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,45 @@ | ||
package io.quarkus.opentelemetry.exporter.otlp.http.deployment; | ||
|
||
import java.util.function.BooleanSupplier; | ||
|
||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.deployment.Feature; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.ExecutionTime; | ||
import io.quarkus.deployment.annotations.Record; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
import io.quarkus.deployment.builditem.LaunchModeBuildItem; | ||
import io.quarkus.opentelemetry.exporter.otlp.http.runtime.OtlpHttpExporterConfig; | ||
import io.quarkus.opentelemetry.exporter.otlp.http.runtime.OtlpHttpExporterProvider; | ||
import io.quarkus.opentelemetry.exporter.otlp.http.runtime.OtlpHttpRecorder; | ||
|
||
public class OtlpHttpExporterProcessor { | ||
|
||
static class OtlpHttpExporterEnabled implements BooleanSupplier { | ||
OtlpHttpExporterConfig.OtlpHttpExporterBuildConfig otlpHttpExporterConfig; | ||
|
||
public boolean getAsBoolean() { | ||
return otlpHttpExporterConfig.enabled; | ||
} | ||
} | ||
|
||
@BuildStep(onlyIf = OtlpHttpExporterEnabled.class) | ||
FeatureBuildItem feature() { | ||
return new FeatureBuildItem(Feature.OPENTELEMETRY_OTLP_HTTP_EXPORTER); | ||
} | ||
|
||
@BuildStep(onlyIf = OtlpHttpExporterEnabled.class) | ||
AdditionalBeanBuildItem createBatchSpanProcessor() { | ||
return AdditionalBeanBuildItem.builder() | ||
.addBeanClass(OtlpHttpExporterProvider.class) | ||
.setUnremovable().build(); | ||
} | ||
|
||
@BuildStep(onlyIf = OtlpHttpExporterEnabled.class) | ||
@Record(ExecutionTime.RUNTIME_INIT) | ||
void installBatchSpanProcessorForOtlpHttp(OtlpHttpRecorder recorder, | ||
LaunchModeBuildItem launchModeBuildItem, | ||
OtlpHttpExporterConfig.OtlpHttpExporterRuntimeConfig runtimeConfig) { | ||
recorder.installBatchSpanProcessorForOtlpHttp(runtimeConfig, launchModeBuildItem.getLaunchMode()); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
.../quarkus/opentelemetry/exporter/otlp/http/deployment/OtlpHttpExporterBadEndpointTest.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,27 @@ | ||
package io.quarkus.opentelemetry.exporter.otlp.http.deployment; | ||
|
||
import javax.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; | ||
|
||
public class OtlpHttpExporterBadEndpointTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withEmptyApplication() | ||
.overrideConfigKey("quarkus.opentelemetry.tracer.exporter.otlp-http.endpoint", "httz://nada:zero") | ||
.setExpectedException(IllegalStateException.class); | ||
|
||
@Inject | ||
OpenTelemetry openTelemetry; | ||
|
||
@Test | ||
void failStart() { | ||
Assertions.fail("Test should not be run as deployment should fail"); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../io/quarkus/opentelemetry/exporter/otlp/http/deployment/OtlpHttpExporterDisabledTest.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.quarkus.opentelemetry.exporter.otlp.http.deployment; | ||
|
||
import javax.enterprise.inject.Instance; | ||
import javax.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.opentelemetry.exporter.otlp.http.runtime.LateBoundBatchSpanProcessor; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OtlpHttpExporterDisabledTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withEmptyApplication() | ||
.overrideConfigKey("quarkus.opentelemetry.tracer.exporter.otlp-http.enabled", "false"); | ||
|
||
@Inject | ||
OpenTelemetry openTelemetry; | ||
|
||
@Inject | ||
Instance<LateBoundBatchSpanProcessor> lateBoundBatchSpanProcessorInstance; | ||
|
||
@Test | ||
void testOpenTelemetryButNoBatchSpanProcessor() { | ||
Assertions.assertNotNull(openTelemetry); | ||
Assertions.assertFalse(lateBoundBatchSpanProcessorInstance.isResolvable()); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
extensions/opentelemetry/opentelemetry-exporter-otlp-http/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,20 @@ | ||
<?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"> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry-parent-aggregator</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-opentelemetry-exporter-otlp-http-parent</artifactId> | ||
<name>Quarkus - OpenTelemetry Exporter - OTLP/HTTP</name> | ||
<packaging>pom</packaging> | ||
<modules> | ||
<module>deployment</module> | ||
<module>runtime</module> | ||
</modules> | ||
</project> |
89 changes: 89 additions & 0 deletions
89
extensions/opentelemetry/opentelemetry-exporter-otlp-http/runtime/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,89 @@ | ||
<?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.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry-exporter-otlp-http-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-opentelemetry-exporter-otlp-http</artifactId> | ||
<name>Quarkus - OpenTelemetry Exporter - OTLP/HTTP - Runtime</name> | ||
<description>Enable OTLP/HTTP Exporter for OpenTelemetry</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-opentelemetry</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-exporter-otlp-http-trace</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>animal-sniffer-annotations</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.checkerframework</groupId> | ||
<artifactId>checker-qual</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-exporter-otlp-common</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>animal-sniffer-annotations</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.checkerframework</groupId> | ||
<artifactId>checker-qual</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.graalvm.nativeimage</groupId> | ||
<artifactId>svm</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-bootstrap-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${project.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.