@@ -4,66 +4,7 @@ weight: 50
4
4
cSpell:ignore : okhttp
5
5
---
6
6
7
- {{% docs/languages/exporters-intro java %}}
8
-
9
- {{% alert title="Note" color="info" %}}
10
-
11
- If you use the Java agent for
12
- [ automatic instrumentation] ( /docs/languages/java/automatic ) you can learn how to
13
- setup exporters following the
14
- [ Agent Configuration Guide] ( /docs/languages/java/automatic/agent-config )
15
-
16
- {{% /alert %}}
17
-
18
- ## OTLP
19
-
20
- ### Collector Setup
21
-
22
- {{% alert title="Note" color="info" %}}
23
-
24
- If you have a OTLP collector or backend already set up, you can skip this
25
- section and [ setup the OTLP exporter dependencies] ( #otlp-dependencies ) for your
26
- application.
27
-
28
- {{% /alert %}}
29
-
30
- To try out and verify your OTLP exporters, you can run the collector in a docker
31
- container that writes telemetry directly to the console.
32
-
33
- In an empty directory, create a file called ` collector-config.yaml ` with the
34
- following content:
35
-
36
- ``` yaml
37
- receivers :
38
- otlp :
39
- protocols :
40
- grpc :
41
- http :
42
- exporters :
43
- debug :
44
- verbosity : detailed
45
- service :
46
- pipelines :
47
- traces :
48
- receivers : [otlp]
49
- exporters : [debug]
50
- metrics :
51
- receivers : [otlp]
52
- exporters : [debug]
53
- logs :
54
- receivers : [otlp]
55
- exporters : [debug]
56
- ` ` `
57
-
58
- Now run the collector in a docker container:
59
-
60
- ` ` ` shell
61
- docker run -p 4317:4317 -p 4318:4318 --rm -v $(pwd)/collector-config.yaml:/etc/otelcol/config.yaml otel/opentelemetry-collector
62
- ```
63
-
64
- This collector is now able to accept telemetry via OTLP. Later you may want to
65
- [ configure the collector] ( /docs/collector/configuration ) to send your telemetry
66
- to your observability backend.
7
+ {{% docs/languages/exporters/intro java %}}
67
8
68
9
### Dependencies {#otlp-dependencies}
69
10
@@ -241,72 +182,9 @@ all you need to do is update your environment variables:
241
182
env OTEL_TRACES_EXPORTER=logging OTEL_METRICS_EXPORTER=logging OTEL_LOGS_EXPORTER=logging java -jar ./build/libs/java-simple.jar
242
183
```
243
184
244
- ## Jaeger
245
-
246
- [ Jaeger] ( https://www.jaegertracing.io/ ) natively supports OTLP to receive trace
247
- data. You can run Jaeger in a docker container with the UI accessible on port
248
- 16686 and OTLP enabled on ports 4137 and 4138:
249
-
250
- ``` shell
251
- docker run --rm \
252
- -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
253
- -p 16686:16686 \
254
- -p 4317:4317 \
255
- -p 4318:4318 \
256
- -p 9411:9411 \
257
- jaegertracing/all-in-one:latest
258
- ```
259
-
260
- Now following the instruction to setup the [ OTLP exporters] ( #otlp-dependencies ) .
261
-
262
- ## Prometheus
263
-
264
- To send your metric data to [ Prometheus] ( https://prometheus.io/ ) , you can either
265
- [ enable Prometheus' OTLP Receiver] ( https://prometheus.io/docs/prometheus/latest/feature_flags/#otlp-receiver )
266
- and use the [ OTLP exporter] ( #otlp ) or you can use the
267
- [ ` PrometheusHttpServer ` ] ( https://javadoc.io/doc/io.opentelemetry/opentelemetry-exporter-prometheus/latest/io/opentelemetry/exporter/prometheus/PrometheusHttpServer.html ) ,
268
- a ` MetricReader ` , that starts an HTTP server that will collect metrics and
269
- serialize to Prometheus text format on request.
270
-
271
- ### Backend Setup {#prometheus-setup}
272
-
273
- {{% alert title="Note" color="info" %}}
274
-
275
- If you have Prometheus or a Prometheus-compatible backend already set up, you
276
- can skip this section and setup the [ Prometheus] ( #prometheus-dependencies ) or
277
- [ OTLP] ( #otlp-dependencies ) exporter dependencies for your application.
278
-
279
- {{% /alert %}}
280
-
281
- You can run [ Prometheus] ( https://prometheus.io ) in a docker container,
282
- accessible on port ` 9090 ` by following these instructions:
283
-
284
- Create a file called ` prometheus.yml ` with the following content:
285
-
286
- ``` yaml
287
- scrape_configs :
288
- - job_name : dice-service
289
- scrape_interval : 5s
290
- static_configs :
291
- - targets : [host.docker.internal:9464]
292
- ` ` `
185
+ {{% docs/languages/exporters/jaeger %}}
293
186
294
- Run Prometheus in a docker container with the UI accessible on port ` 9090`:
295
-
296
- ` ` ` shell
297
- docker run --rm -v ${PWD}/prometheus.yml:/prometheus/prometheus.yml -p 9090:9090 prom/prometheus --enable-feature=otlp-write-receive
298
- ` ` `
299
-
300
- {{% alert title="Note" color="info" %}}
301
-
302
- When using Prometheus' OTLP Receiver, make sure that you set the OTLP endpoint
303
- for metrics in your application to `http://localhost:9090/api/v1/otlp`.
304
-
305
- Not all docker environments support `host.docker.internal`. In some cases you
306
- may need to replace `host.docker.internal` with `localhost` or the IP address of
307
- your machine.
308
-
309
- {{% /alert %}}
187
+ {{% docs/languages/exporters/prometheus-setup %}}
310
188
311
189
### Dependencies {#prometheus-dependencies}
312
190
@@ -354,24 +232,7 @@ With the above you can access your metrics at <http://localhost:9464/metrics>.
354
232
Prometheus or an OpenTelemetry Collector with the Prometheus receiver can scrape
355
233
the metrics from this endpoint.
356
234
357
- # # Zipkin
358
-
359
- # ## Backend Setup {#zipkin-setup}
360
-
361
- {{% alert title="Note" color="info" %}}
362
-
363
- If you have Zipkin or a Zipkin-compatible backend already set up, you can skip
364
- this section and setup the [Zipkin exporter dependencies](#zipkin-dependencies)
365
- for your application.
366
-
367
- {{% /alert %}}
368
-
369
- You can run [Zipkin](https://zipkin.io/) on ina Docker container by executing
370
- the following command :
371
-
372
- ` ` ` shell
373
- docker run --rm -d -p 9411:9411 --name zipkin openzipkin/zipkin
374
- ` ` `
235
+ {{% docs/languages/exporters/zipkin-setup %}}
375
236
376
237
### Dependencies {#zipkin-dependencies}
377
238
@@ -417,18 +278,7 @@ SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
417
278
.build();
418
279
```
419
280
420
- # # Other available exporters
421
-
422
- There are many other exporters available. For a list of available exporters, see
423
- the [registry](/ecosystem/registry/?component=exporter&language=java).
424
-
425
- Finally, you can also write your own exporter. For more information, see the
426
- [SpanExporter Interface in the API documentation](https://javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-trace/latest/io/opentelemetry/sdk/trace/export/SpanExporter.html).
427
-
428
- # # Batching spans and log records
429
-
430
- For traces the OpenTelemetry SDK provides a set of default span and log record
431
- processors, that allow you to either emit them one-by-one ("simple") or batched :
281
+ {{% docs/languages/exporters/outro java "https://javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-trace/latest/io/opentelemetry/sdk/trace/export/SpanExporter.html " %}}
432
282
433
283
{{< tabpane text=true >}} {{% tab Batch %}}
434
284
@@ -467,3 +317,5 @@ SdkLoggerProvider sdkLoggerProvider = SdkLoggerProvider.builder()
467
317
```
468
318
469
319
{{< /tab >}} {{< /tabpane>}}
320
+
321
+ {{% /docs/languages/exporters/outro %}}
0 commit comments