Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple exporters via OTLP_EXPORTER config #1242

Merged
merged 6 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ Note: These parameter names are very likely to change over time, so please check
back here when trying out a new version! Please report any bugs or unexpected
behavior you may find.

#### Jaeger exporter
#### Exporters

The following configuration properties are common to all exporters:

| System property | Environment variable | Purpose |
|--------------------------|--------------------------|----------------------------------------------------------------------------------------------------|
| otel.exporter | OTEL_EXPORTER | To select exporter e.g. `otlp,jaeger`. Defaults to `otlp` |

##### Jaeger exporter

A simple wrapper for the Jaeger exporter of opentelemetry-java. It currently
only supports gRPC as its communications protocol.
Expand All @@ -67,7 +75,7 @@ only supports gRPC as its communications protocol.
| otel.jaeger.endpoint | OTEL_JAEGER_ENDPOINT | The Jaeger endpoint to connect to, default is "localhost:14250", currently only gRPC is supported. |
| otel.jaeger.service.name | OTEL_JAEGER_SERVICE_NAME | The service name of this JVM instance, default is "unknown". |

#### Zipkin exporter
##### Zipkin exporter
A simple wrapper for the Zipkin exporter of opentelemetry-java. It POSTs json in [Zipkin format](https://zipkin.io/zipkin-api/#/default/post_spans) to a specified HTTP URL.

| System property | Environment variable | Purpose |
Expand All @@ -76,7 +84,7 @@ A simple wrapper for the Zipkin exporter of opentelemetry-java. It POSTs json in
| otel.zipkin.endpoint | OTEL_ZIPKIN_ENDPOINT | The Zipkin endpoint to connect to, default is "http://localhost:9411/api/v2/spans". Currently only HTTP is supported. |
| otel.zipkin.service.name | OTEL_ZIPKIN_SERVICE_NAME | The service name of this JVM instance, default is "unknown". |

#### OTLP exporter
##### OTLP exporter

A simple wrapper for the OTLP exporter of opentelemetry-java.

Expand All @@ -91,7 +99,7 @@ A simple wrapper for the OTLP exporter of opentelemetry-java.
In order to configure the service name for the OTLP exporter, you must add `service.name` key
to the OpenTelemetry Resource ([see below](#opentelemetry-resource)), e.g. `OTEL_RESOURCE_ATTRIBUTES=service.name=myservice`.

#### Logging exporter
##### Logging exporter

The logging exporter simply prints the name of the span along with its
attributes to stdout. It is used mainly for testing and debugging.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,24 @@ public static synchronized void installAgentTracer() {
PropagatorsInitializer.initializePropagators(Config.get().getPropagators());
}

private static synchronized void installExporters(String exporterName) {
SpanExporterFactory spanExporterFactory = findSpanExporterFactory(exporterName);
if (spanExporterFactory != null) {
DefaultExporterConfig config = new DefaultExporterConfig("exporter");
installExporter(spanExporterFactory, config);
} else {
log.warn("No {} span exporter found", exporterName);
log.warn("No valid span exporter found. Tracing will run but spans are dropped");
}
private static synchronized void installExporters(String exportersName) {
String[] exporters = exportersName.split(",", -1);
for (String exporterName : exporters) {
SpanExporterFactory spanExporterFactory = findSpanExporterFactory(exporterName);
if (spanExporterFactory != null) {
DefaultExporterConfig config = new DefaultExporterConfig("exporter");
installExporter(spanExporterFactory, config);
} else {
log.warn("No {} span exporter found", exporterName);
}

MetricExporterFactory metricExporterFactory = findMetricExporterFactory(exporterName);
if (metricExporterFactory != null) {
DefaultExporterConfig config = new DefaultExporterConfig("exporter");
installExporter(metricExporterFactory, config);
} else {
log.debug("No {} metric exporter found", exporterName);
MetricExporterFactory metricExporterFactory = findMetricExporterFactory(exporterName);
if (metricExporterFactory != null) {
DefaultExporterConfig config = new DefaultExporterConfig("exporter");
installExporter(metricExporterFactory, config);
} else {
log.debug("No {} metric exporter found", exporterName);
}
}
}

Expand Down