Skip to content

Commit

Permalink
Describe java OTLP exporter options (#3272)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg authored Sep 15, 2023
1 parent 1fb0f48 commit cebd61b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 3 deletions.
51 changes: 48 additions & 3 deletions content/en/docs/instrumentation/java/exporters.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Exporters
weight: 50
cSpell:ignore: autoconfigure springframework
cSpell:ignore: autoconfigure classpath okhttp springframework
---

In order to visualize and analyze your traces, you will need to export them to a
Expand All @@ -17,10 +17,15 @@ how to setup exporters following the
For [manual instrumentation](/docs/instrumentation/java/manual), you will find
some introductions below on how to set up backends and the matching exporters.

## OTLP endpoint
## OTLP

To send trace data to a OTLP endpoint (like the [collector](/docs/collector) or
Jaeger) you'll want to use `opentelemetry-exporter-otlp`:
Jaeger) you'll want to use `opentelemetry-exporter-otlp`.

### OTLP Artifacts

There are multiple OTLP options available, each catering to different use cases.
For most users, the default artifact will suffice and be the most simple:

{{< tabpane text=true >}} {{% tab Gradle %}}

Expand All @@ -45,6 +50,46 @@ dependencies {

{{< /tab >}} {{< /tabpane>}}

Under the hood, there are two protocol options supported, each with different
"sender" implementations.

- `grpc` - gRPC implementation of OTLP exporters, represented by
`OtlpGrpcSpanExporter`, `OtlpGrpcMetricExporter`, `OtlpGrpcLogRecordExporter`.
- `http/protobuf` - HTTP with protobuf encoded payload implementation of OTLP
exporters, represented by `OtlpHttpSpanExporter`, `OtlpHttpMetricExporter`,
`OtlpHttpLogRecordExporter`.

A sender is an abstraction which allows different gRPC / HTTP client
implementations to fulfill the OTLP contract. Regardless of the sender
implementation, the same exporter classes are used. A sender implementation is
automatically used when it is detected on the classpath. The sender
implementations are described in detail below:

- `{groupId}:{artifactId}` - Sender description.
- `io.opentelemetry:opentelemetry-exporter-sender-okhttp` - The default sender,
included automatically with `opentelemetry-exporter-otlp` and bundled with the
OpenTelemetry Java agent. This includes an
[OkHttp](https://square.github.io/okhttp/) based implementation for both the
`grpc` and `http/protobuf` versions of the protocol, and will be suitable for
most users. However, OkHttp has a transitive dependency on kotlin which is
problematic in some environments.
- `io.opentelemetry:opentelemetry-exporter-sender-jdk` - This sender includes a
JDK 11+
[HttpClient](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html)
based implementation for the `http/protobuf` version of the protocol. It
requires zero additional dependencies, but requires Java 11+. To use, include
the artifact and explicitly exclude the default
`io.opentelemetry:opentelemetry-exporter-sender-okhttp` dependency.
- `io.opentelemetry:opentelemetry-exporter-sender-grpc-managed-channel` - This
sender includes a [grpc-java](https://github.com/grpc/grpc-java) based
implementation for the `grpc` version of the protocol. To use, include the
artifact, explicitly exclude the default
`io.opentelemetry:opentelemetry-exporter-sender-okhttp` dependency, and
include one of the
[gRPC transport implementations](https://github.com/grpc/grpc-java#transport).

### Usage

Next, configure the exporter to point at an OTLP endpoint.

If you use
Expand Down
16 changes: 16 additions & 0 deletions static/refcache.json
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,10 @@
"StatusCode": 200,
"LastSeen": "2023-06-29T15:47:40.319503-04:00"
},
"https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html": {
"StatusCode": 200,
"LastSeen": "2023-09-14T09:36:38.052527-05:00"
},
"https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpHeaders.html": {
"StatusCode": 200,
"LastSeen": "2023-06-29T15:54:32.716302-04:00"
Expand Down Expand Up @@ -2007,6 +2011,14 @@
"StatusCode": 200,
"LastSeen": "2023-06-30T09:15:19.257742-04:00"
},
"https://github.com/grpc/grpc-java": {
"StatusCode": 200,
"LastSeen": "2023-09-14T09:36:39.160279-05:00"
},
"https://github.com/grpc/grpc-java#transport": {
"StatusCode": 200,
"LastSeen": "2023-09-14T09:36:39.672623-05:00"
},
"https://github.com/hashicorp/nomad-open-telemetry-getting-started": {
"StatusCode": 200,
"LastSeen": "2023-06-30T08:44:24.194485-04:00"
Expand Down Expand Up @@ -4699,6 +4711,10 @@
"StatusCode": 200,
"LastSeen": "2023-06-30T11:44:31.406627-04:00"
},
"https://square.github.io/okhttp/": {
"StatusCode": 206,
"LastSeen": "2023-09-14T09:36:37.578867-05:00"
},
"https://stackoverflow.com/questions/5626193/what-is-monkey-patching": {
"StatusCode": 200,
"LastSeen": "2023-06-29T18:45:47.500299-04:00"
Expand Down

0 comments on commit cebd61b

Please sign in to comment.