Skip to content

Commit 596d362

Browse files
committed
revised Java setup docs
Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
1 parent fc6b985 commit 596d362

File tree

2 files changed

+57
-30
lines changed

2 files changed

+57
-30
lines changed

docs/_edot-sdks/java/setup/index.md

+56-29
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,76 @@ parent: EDOT Java
77

88
# Setting up the EDOT Java Agent
99

10+
**Kubernetes**
11+
12+
For Kubernetes we recommend using the OTel Kubernetes Operator that also manages the auto-instrumentation of Java applications. Follow the [Quickstart Guide](../../../quickstart/index) for Kubernetes or learn more about [instrumentation details on Kubernetes for Java](./k8s).
13+
14+
**All other environments**
15+
16+
Follow the Java setup guide below for all other environments.
17+
1018
## Download
1119

12-
Latest release: [![Maven Central](https://img.shields.io/maven-central/v/co.elastic.otel/elastic-otel-javaagent?label=elastic-otel-javaagent)](https://mvnrepository.com/artifact/co.elastic.otel/elastic-otel-javaagent/latest)
20+
You can download the latest release version or snapshot version of the EDOT Java Agent from the following links:
1321

14-
Latest snapshot: [![Sonatype Nexus](https://img.shields.io/nexus/s/co.elastic.otel/elastic-otel-javaagent?server=https%3A%2F%2Foss.sonatype.org&label=elastic-otel-javaagent)](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=co.elastic.otel&a=elastic-otel-javaagent&v=LATEST)
22+
| Latest Release | Latest Snapshot |
23+
|:---:|:---:|
24+
| [![Maven Central](https://img.shields.io/maven-central/v/co.elastic.otel/elastic-otel-javaagent?label=elastic-otel-javaagent&style=for-the-badge)](https://mvnrepository.com/artifact/co.elastic.otel/elastic-otel-javaagent/latest) | [![Sonatype Nexus](https://img.shields.io/nexus/s/co.elastic.otel/elastic-otel-javaagent?server=https%3A%2F%2Foss.sonatype.org&label=elastic-otel-javaagent&style=for-the-badge)](https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=co.elastic.otel&a=elastic-otel-javaagent&v=LATEST) |
1525

1626
## Prerequisites
1727

1828
You need to have completed the steps in the [Quickstart](/quickstart/) section that corresponds to your Elastic deployment model.
1929

20-
## Run
30+
## Setting up the Agent
31+
32+
1. **Configure the agent**
33+
34+
The minimal configuration to send data involves setting the values for `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables.
35+
36+
Configuration of those environment values depends on the deployment model:
37+
38+
*Local EDOT Collector*
39+
40+
EDOT Collector is accessible with `http://localhost:4318` without authentication, no further configuration is required.
41+
42+
*Self-managed EDOT Collector*
43+
44+
`OTEL_EXPORTER_OTLP_ENDPOINT` should be set to the OTLP endpoint of your selfmanaged EDOT Collector.
45+
46+
*Elastic Managed OTLP endpoint*
47+
48+
Use [these guides](../../../quickstart/serverless/index) to retrieve the `<ELASTIC_OTLP_ENDPOINT>` and the `<ELASTIC_API_KEY>`.
49+
50+
- `OTEL_EXPORTER_OTLP_ENDPOINT` should be set to `<ELASTIC_OTLP_ENDPOINT>`
51+
- `OTEL_EXPORTER_OTLP_HEADERS` should be set to include `Authorization=ApiKey <ELASTIC_API_KEY>` (comma-separated key=value list).
52+
53+
*Kubernetes*
54+
55+
Connection to the EDOT Collector is managed by the OTel Kubernetes Operator, [follow the Quickstart Guides](../../../quickstart/index) for Kubernetes.
56+
2157

22-
Use the `-javaagent:` JVM argument with the path to agent jar, this requires to modify the JVM arguments and restart
23-
the application.
58+
We also recommend setting the `service.name` resource attribute explicitly:
2459

25-
```bash
26-
java \
27-
-javaagent:/path/to/agent.jar \
28-
-jar myapp.jar
29-
```
60+
TODO
3061

31-
For applications deployed with Kubernetes, we recommend using [OpenTelemetry Operator](./k8s).
62+
Set the `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables. For example:
3263

33-
## Minimal configuration
64+
```bash
65+
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io
66+
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=ApiKey P....l"
67+
```
3468

35-
The minimal configuration to send data involves setting the values for `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables.
69+
For more advanced configuration, see [Configuration](../configuration) section.
3670

37-
Configuration of those environment values depends on the deployment model:
38-
- EDOT Collector running on the application host, accessible with `http://localhost:4318` without authentication, no further configuration is required.
39-
- EDOT Collector managed by the OpenTelemetry Kubernetes Operator
40-
- `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables are automatically provided by the Operator, no further configuration is required.
41-
- Elastic Managed OTLP endpoint (Elastic Cloud Serverless):
42-
- `OTEL_EXPORTER_OTLP_ENDPOINT` should be set to `<ELASTIC_OTLP_ENDPOINT>`
43-
- `OTEL_EXPORTER_OTLP_HEADERS` should be set to include `Authorization=ApiKey <ELASTIC_API_KEY>` (comma-separated key=value list).
44-
- Self-managed EDOT Collector:
45-
- `OTEL_EXPORTER_OTLP_ENDPOINT` should be set to the OTLP endpoint of EDOT Collector
46-
- `OTEL_EXPORTER_OTLP_HEADERS` should be set to include `Authorization=ApiKey <ELASTIC_API_KEY>` (comma-separated key=value list).
71+
2. **Run the Java Agent**
4772

48-
For example:
73+
Use the `-javaagent:` JVM argument with the path to agent jar, this requires to modify the JVM arguments and restart
74+
the application.
4975

50-
```shell
51-
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io
52-
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=ApiKey P....l"
53-
```
76+
```bash
77+
java \
78+
-javaagent:/path/to/agent.jar \
79+
-jar myapp.jar
80+
```
5481

55-
For more advanced configuration, see [Configuration](../configuration) section.
82+
For applications deployed with Kubernetes, we recommend using [OpenTelemetry Operator](./k8s).

docs/_edot-sdks/java/setup/k8s.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This document focuses on instrumenting Java applications on Kubernetes, using th
1212

1313
- For general knowledge about the EDOT Java SDK, refer to the [EDOT Java Intro page](../index).
1414
- For Java auto-instrumentation specifics, refer to [OpenTelemetry Operator Java auto-instrumentation](https://opentelemetry.io/docs/kubernetes/operator/automatic/#java).
15-
- For general information about instrumenting applications on kubernetes, refer to [instrumenting applications on Kubernetes](../../../use-cases/kubernetes/instrumenting-applications).
15+
- For general information about instrumenting applications on Kubernetes, refer to [instrumenting applications on Kubernetes](../../../use-cases/kubernetes/instrumenting-applications).
1616

1717
## Java agent extensions consideration
1818

0 commit comments

Comments
 (0)