Skip to content

Commit

Permalink
[vertx_quarkus_fork]
Browse files Browse the repository at this point in the history
Add fork of Quarkus vertx-based gRPC exporters
Create new module for exporters
Bump version
  • Loading branch information
jasondlee committed Nov 7, 2023
1 parent d17d422 commit a859d58
Show file tree
Hide file tree
Showing 23 changed files with 804 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/project.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: SmallRye Config
release:
current-version: 2.5.0
next-version: 2.5.1-SNAPSHOT
next-version: 2.6.0-SNAPSHOT
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-parent</artifactId>
<version>2.5.1-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-opentelemetry-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@
import java.util.Optional;

public interface OpenTelemetryConfig {
String OTEL_BSP_MAX_EXPORT_BATCH_SIZE = "otel.bsp.max.export.batch.size";
String OTEL_BSP_MAX_QUEUE_SIZE = "otel.bsp.max.queue.size";
String OTEL_BSP_SCHEDULE_DELAY = "otel.bsp.schedule.delay";
String OTEL_EXPERIMENTAL_SDK_ENABLED = "otel.experimental.sdk.enabled";
String OTEL_EXPORTER_JAEGER_ENDPOINT = "otel.exporter.jaeger.endpoint";
String OTEL_EXPORTER_JAEGER_TIMEOUT = "otel.exporter.jaeger.timeout";
String OTEL_EXPORTER_OTLP_ENDPOINT = "otel.exporter.otlp.endpoint";
String OTEL_EXPORTER_OTLP_PROTOCOL = "otel.exporter.otlp.protocol";
String OTEL_EXPORTER_OTLP_TIMEOUT = "otel.exporter.otlp.timeout";
String OTEL_LOGS_EXPORTER = "otel.logs.exporter";
String OTEL_METRICS_EXPORTER = "otel.metrics.exporter";
String OTEL_SDK_DISABLED = "otel.sdk.disabled";
String OTEL_SERVICE_NAME = "otel.service.name";
String OTEL_SPAN_PROCESSOR_TYPE = "wildfly.span.processor.type";
String OTEL_TRACES_EXPORTER = "otel.traces.exporter";
String OTEL_TRACES_SAMPLER = "otel.traces.sampler";
String OTEL_TRACES_SAMPLER_ARG = "otel.traces.sampler.arg";
String PROTOCOL_GRPC = "grpc";
String PROTOCOL_HTTP = "http/protobuf";

String INSTRUMENTATION_NAME = "io.smallrye.opentelemetry";

String INSTRUMENTATION_VERSION = Optional.ofNullable(OpenTelemetryConfig.class.getPackage().getImplementationVersion())
Expand Down
2 changes: 1 addition & 1 deletion examples/agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>io.smallrye.opentelemetry.examples</groupId>
<artifactId>agent</artifactId>
<version>2.5.1-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>SmallRye OpenTelemetry Examples: Agent</name>

Expand Down
2 changes: 1 addition & 1 deletion examples/library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>io.smallrye.opentelemetry.examples</groupId>
<artifactId>library</artifactId>
<version>2.5.1-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>SmallRye OpenTelemetry Examples: Library</name>

Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-parent</artifactId>
<version>2.5.1-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<groupId>io.smallrye.config.examples</groupId>
Expand Down
10 changes: 9 additions & 1 deletion implementation/cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-parent</artifactId>
<version>2.5.1-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -46,10 +46,18 @@
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-exporters</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-config</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion implementation/config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-parent</artifactId>
<version>2.5.1-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
77 changes: 77 additions & 0 deletions implementation/exporters/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-parent</artifactId>
<version>2.6.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>smallrye-opentelemetry-exporters</artifactId>
<name>SmallRye OpenTelemetry: Exporters</name>

<dependencies>
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-api</artifactId>
</dependency>

<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<scope>provided</scope>
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-junit5</artifactId>
<exclusions>
<exclusion>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-config</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-common</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>4.4.6</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-grpc-client</artifactId>
<version>4.4.6</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp-common</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.smallrye.opentelemetry.implementation.exporters;

import java.io.IOException;
import java.io.OutputStream;

import io.vertx.core.buffer.Buffer;

public class BufferOutputStream extends OutputStream {

private final Buffer buffer;

public BufferOutputStream(Buffer buffer) {
this.buffer = buffer;
}

@Override
public void write(byte[] b, int off, int len) throws IOException {
buffer.appendBytes(b, off, len);
}

@Override
public void write(int b) throws IOException {
buffer.appendInt(b);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.smallrye.opentelemetry.implementation.exporters;

import java.net.URI;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import io.opentelemetry.exporter.otlp.internal.OtlpUserAgent;

public final class OtlpExporterUtil {

private OtlpExporterUtil() {
}

static int getPort(URI uri) {
int originalPort = uri.getPort();
if (originalPort > -1) {
return originalPort;
}

if (isHttps(uri)) {
return 443;
}
return 80;
}

public static Map<String, String> populateTracingExportHttpHeaders() {
Map<String, String> headersMap = new HashMap<>();
OtlpUserAgent.addUserAgentHeader(headersMap::put);
return headersMap;
}

static boolean isHttps(URI uri) {
return "https".equals(uri.getScheme().toLowerCase(Locale.ROOT));
}
}
Loading

0 comments on commit a859d58

Please sign in to comment.