A few exporter improvements
MODIFY
README.md
README.md
@@ -73,38 +73,36 @@ The instrumentation agent is enabled using the -javaagent flag to the JVM. Confi
as Java system properties (-D flags) or as environment variables. This is an example:
```
-java -javaagent:/path/to/opentelemetry-auto-<version>.jar \
- -Dota.exporter.jar=exporter-adapters/logging-exporter-adapter/build/libs/logging-exporter-adapter-0.1.2-SNAPSHOT.jar \
- -Dota.jaeger.host=localhost \
- -Dota.jaeger.port=14250 \
- -Dota.service=shopping \
+java -javaagent:path/to/opentelemetry-auto-<version>.jar \
+ -Dota.exporter.jar=path/to/opentelemetry-auto-exporters-jaeger-<version>.jar \
+ -Dota.exporter.jaeger.endpoint=localhost:14250 \
+ -Dota.exporter.jaeger.service.name=shopping \
-jar myapp.jar
```
### Configuration parameters (subject to change!)
-System property | Environment variable | Purpose
---- | --- | ---
-ota.exporter.jar | OTA_EXPORTER_JAR | The path to an exporter JAR
-ota.service | OTA_SERVICE | The service name of this JVM instance. This is used as a label in Jaeger to distinguish between JVM instances in a multi-service environment.
+| System property | Environment variable | Purpose |
+|------------------|----------------------|---------------------------------------------------|
+| ota.exporter.jar | OTA_EXPORTER_JAR | Path to the exporter fat-jar that you want to use |
### Available exporters
Currently two exporters are available and bundled with this project. They area available under the ```exporter-adapters``` directory.
+#### Jaeger exporter
+A simple wrapper for the Jaeger exporter of opentelemetry-java. It currently only supports gRPC as its communications protocol.
+
+| System property | Environment variable | Purpose |
+|----------------------------------|----------------------------------|----------------------------------------------------------------------|
+| ota.exporter.jaeger.host | OTA_EXPORTER_JAEGER_ENDPOINT | The Jaeger endpoint to connect to. Currently only gRPC is supported. |
+| ota.exporter.jaeger.service.name | OTA_EXPORTER_JAEGER_SERVICE_NAME | The service name of this JVM instance |
+
#### Logging Exporter
The logging exporter simply prints the name of the span along with its attributes to stdout. It is used manly
for testing and debugging. It takes a single configuration parameter.
-System property | Environment variable | Purpose
---- | --- | ---
-ota.exporter.logging.prefix | OTA_EXPORTER_LOGGING_PREFIX | A string that is printed in front of the span name and attributes.
-
-#### Jaeger exporter
-A simple wrapper for the Jaeger exporter of opentelemetry-java. It currently only supports gRPC as its communications protocol.
-
-System property | Environment variable | Purpose
---- | --- | ---
-ota.exporter.jaeger.host | OTA_EXPORTER_JAEGER_HOST | The Jaeger host to connect to. Currently only gRPC is supported.
-ota.exporter.jaeger.port | OTA_EXPORTER_JAEGER_PORT | The port to connect to on the Jaeger host. Currently only gRPC is supported
+| System property | Environment variable | Purpose |
+|-----------------------------|-----------------------------|--------------------------------------------------------------------|
+| ota.exporter.logging.prefix | OTA_EXPORTER_LOGGING_PREFIX | A string that is printed in front of the span name and attributes. |
These parameter names are very likely to change over time, so please check back here when trying out a new version!

ADD
auto-exporters/auto-exporters.gradle
+apply from: "${rootDir}/gradle/java.gradle"
+
+dependencies {
+ testCompile project(':auto-tooling')
+
+ testCompile project(':auto-exporters:opentelemetry-auto-exporters-jaeger')
+ testCompile project(':auto-exporters:opentelemetry-auto-exporters-logging')
+}
+
+tasks.withType(Test).configureEach() {
+ dependsOn ':auto-exporters:opentelemetry-auto-exporters-jaeger:shadowJar'
+ dependsOn ':auto-exporters:opentelemetry-auto-exporters-logging:shadowJar'
+ doFirst {
+ systemProperty 'projectVersion', allprojects.version[0]
+ systemProperty 'adapterRoot', "${rootDir}/auto-exporters"
+ systemProperty 'jaegerExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-jaeger').tasks.shadowJar.archivePath
+ systemProperty 'loggingExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-logging').tasks.shadowJar.archivePath
+ }
+}

RENAME
exporter-adapters/jaeger-adapter/jaeger-adapter.gradle
auto-exporters/jaeger/jaeger.gradle
@@ -5,7 +5,14 @@ plugins {
apply from: "${rootDir}/gradle/java.gradle"
dependencies {
- compile deps.opentelemetryJaeger
+ compile(deps.opentelemetryJaeger) {
+ exclude group: 'io.opentelemetry', module: 'opentelemetry-sdk'
+ }
compileOnly deps.opentelemetrySdkAutoConfig
compile group: 'io.grpc', name: 'grpc-api', version: '1.24.0'
+ compile group: 'io.grpc', name: 'grpc-netty-shaded', version: '1.24.0'
+}
+
+shadowJar {
+ archiveClassifier = ''
}

RENAME
exporter-adapters/jaeger-adapter/src/main/java/io/opentelemetry/auto/exporters/jaeger/JaegerExporterFactory.java
auto-exporters/jaeger/src/main/java/io/opentelemetry/auto/exporters/jaeger/JaegerExporterFactory.java
*/
package io.opentelemetry.auto.exporters.jaeger;
-import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.opentelemetry.exporters.jaeger.JaegerGrpcSpanExporter;
import io.opentelemetry.sdk.contrib.auto.config.Config;
@@ -23,29 +22,19 @@ import io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory;
import io.opentelemetry.sdk.trace.export.SpanExporter;
public class JaegerExporterFactory implements SpanExporterFactory {
- private static final String HOST_CONFIG = "jaeger.host";
+ private static final String JAEGER_ENDPOINT = "jaeger.endpoint";
+ private static final String DEFAULT_JAEGER_ENDPOINT = "localhost:14250";
- private static final String PORT_CONFIG = "jaeger.port";
-
- private static final String SERVICE_CONFIG = "service";
-
- private static final int DEFAULT_PORT = 14250;
-
- private static final String DEFAULT_SERVICE = "(unknown service)";
+ private static final String JAEGER_SERVICE_NAME = "jaeger.service.name";
+ private static final String DEFAULT_JAEGER_SERVICE_NAME = "(unknown service)";
@Override
public SpanExporter fromConfig(final Config config) {
- final String host = config.getString(HOST_CONFIG, null);
- if (host == null) {
- throw new IllegalArgumentException(HOST_CONFIG + " must be specified");
- }
- final int port = config.getInt(PORT_CONFIG, DEFAULT_PORT);
- final String service = config.getString(SERVICE_CONFIG, DEFAULT_SERVICE);
- final ManagedChannel jaegerChannel =
- ManagedChannelBuilder.forAddress(host, port).usePlaintext().build();
+ final String jaegerEndpoint = config.getString(JAEGER_ENDPOINT, DEFAULT_JAEGER_ENDPOINT);
+ final String serviceName = config.getString(JAEGER_SERVICE_NAME, DEFAULT_JAEGER_SERVICE_NAME);
return JaegerGrpcSpanExporter.newBuilder()
- .setServiceName(service)
- .setChannel(jaegerChannel)
+ .setServiceName(serviceName)
+ .setChannel(ManagedChannelBuilder.forTarget(jaegerEndpoint).usePlaintext().build())
.build();
}
}

RENAME
exporter-adapters/jaeger-adapter/src/main/resources/META-INF/services/io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory
auto-exporters/jaeger/src/main/resources/META-INF/services/io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory
RENAME
exporter-adapters/logging-exporter-adapter/logging-exporter-adapter.gradle
auto-exporters/logging/logging.gradle
@@ -10,3 +10,6 @@ dependencies {
compileOnly deps.opentelemetrySdkAutoConfig
}
+shadowJar {
+ archiveClassifier = ''
+}

RENAME
exporter-adapters/logging-exporter-adapter/src/main/java/io/opentelemetry/auto/exporters/loggingexporter/LoggingExporter.java
auto-exporters/logging/src/main/java/io/opentelemetry/auto/exporters/logging/LoggingExporter.java
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.opentelemetry.auto.exporters.loggingexporter;
+package io.opentelemetry.auto.exporters.logging;
import io.opentelemetry.common.AttributeValue;
import io.opentelemetry.sdk.trace.data.SpanData;

RENAME
exporter-adapters/logging-exporter-adapter/src/main/java/io/opentelemetry/auto/exporters/loggingexporter/LoggingExporterFactory.java
auto-exporters/logging/src/main/java/io/opentelemetry/auto/exporters/logging/LoggingExporterFactory.java
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.opentelemetry.auto.exporters.loggingexporter;
+package io.opentelemetry.auto.exporters.logging;
import io.opentelemetry.sdk.contrib.auto.config.Config;
import io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory;
@@ -22,6 +22,6 @@ import io.opentelemetry.sdk.trace.export.SpanExporter;
public class LoggingExporterFactory implements SpanExporterFactory {
@Override
public SpanExporter fromConfig(final Config config) {
- return new LoggingExporter(config.getString("logging.prefix", "no-prefix"));
+ return new LoggingExporter(config.getString("logging.prefix", "Logging Exporter:"));
}
}

ADD
auto-exporters/logging/src/main/resources/META-INF/services/io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory
+io.opentelemetry.auto.exporters.logging.LoggingExporterFactory

RENAME
exporter-adapters/src/test/groovy/io/opentelemetry/auto/exporteradapters/ExporterAdaptersTest.groovy
auto-exporters/src/test/groovy/io/opentelemetry/auto/exporteradapters/ExporterAdaptersTest.groovy
@@ -66,6 +66,6 @@ class ExporterAdaptersTest extends Specification {
where:
exporter | classname
jaegerExporterJar | 'io.opentelemetry.auto.exporters.jaeger.JaegerExporterFactory'
- loggingExporterJar | 'io.opentelemetry.auto.exporters.loggingexporter.LoggingExporterFactory'
+ loggingExporterJar | 'io.opentelemetry.auto.exporters.logging.LoggingExporterFactory'
}
}

DELETE
exporter-adapters/exporter-adapters.gradle
-apply from: "${rootDir}/gradle/java.gradle"
-
-dependencies {
- testCompile project(':auto-tooling')
-
- testCompile project(':exporter-adapters:jaeger-adapter')
- testCompile project(':exporter-adapters:logging-exporter-adapter')
-}
-
-tasks.withType(Test).configureEach() {
- dependsOn ':exporter-adapters:logging-exporter-adapter:shadowJar'
- dependsOn ':exporter-adapters:jaeger-adapter:shadowJar'
- doFirst {
- systemProperty 'projectVersion', allprojects.version[0]
- systemProperty 'adapterRoot', "${rootDir}/exporter-adapters"
- systemProperty 'loggingExporterJar', project(':exporter-adapters:logging-exporter-adapter').tasks.shadowJar.archivePath
- systemProperty 'jaegerExporterJar', project(':exporter-adapters:jaeger-adapter').tasks.shadowJar.archivePath
- }
-}
-
-

DELETE
exporter-adapters/logging-exporter-adapter/src/main/resources/META-INF/services/io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory
-io.opentelemetry.auto.exporters.loggingexporter.LoggingExporterFactory

MODIFY
settings.gradle
settings.gradle
@@ -138,9 +138,9 @@ include ':instrumentation:twilio-6.6'
include ':instrumentation:vertx-testing'
// exporter adapters
-include ":exporter-adapters"
-include ":exporter-adapters:logging-exporter-adapter"
-include ":exporter-adapters:jaeger-adapter"
+include ":auto-exporters"
+include ":auto-exporters:jaeger"
+include ":auto-exporters:logging"
// benchmark
include ':benchmark'
@@ -160,3 +160,5 @@ setBuildFile(rootProject)
project(':agent-bootstrap').name = 'auto-bootstrap'
project(':agent-tooling').name = 'auto-tooling'
project(':java-agent').name = 'opentelemetry-auto'
+project(':auto-exporters:jaeger').name = 'opentelemetry-auto-exporters-jaeger'
+project(':auto-exporters:logging').name = 'opentelemetry-auto-exporters-logging'

MODIFY
smoke-tests/smoke-tests.gradle
smoke-tests/smoke-tests.gradle
@@ -5,7 +5,7 @@ description = 'smoke-tests'
dependencies {
compile deps.spock
compile project(':testing')
- compile project(':exporter-adapters:logging-exporter-adapter')
+ compile project(':auto-exporters:opentelemetry-auto-exporters-logging')
}
subprojects { subProject ->
@@ -16,7 +16,7 @@ subprojects { subProject ->
// Tests depend on this to know where to run things and what agent jar to use
jvmArgs "-Dio.opentelemetry.smoketest.builddir=${buildDir}"
jvmArgs "-Dio.opentelemetry.smoketest.agent.shadowJar.path=${project(':opentelemetry-auto').tasks.shadowJar.archivePath}"
- jvmArgs "-Dota.exporter.jar=${project(':exporter-adapters:logging-exporter-adapter').tasks.shadowJar.archivePath}"
+ jvmArgs "-Dota.exporter.jar=${project(':auto-exporters:opentelemetry-auto-exporters-logging').tasks.shadowJar.archivePath}"
}
}
}

A few exporter improvements (#288)