Skip to content

Commit 84e1897

Browse files
Merge pull request #94 from SylvainJuge/enhance-java-setup
enhance java setup
2 parents 844316d + bca9980 commit 84e1897

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

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

+36-35
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,59 @@ You can download the latest release version or snapshot version of the EDOT Java
2727

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

30-
## Setting up the Agent
30+
## Configure the Java agent
3131

32-
1. **Configure the agent**
32+
The minimal configuration to send data involves setting the values for `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables.
3333

34-
The minimal configuration to send data involves setting the values for `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables.
34+
We also recommend setting the `service.name` resource attribute explicitly with `OTEL_SERVICE_NAME` as it allows to qualify captured data and group multiple service instances together.
3535

36-
Configuration of those environment values depends on the deployment model:
36+
Here is an example to set `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_SERVICE_NAME` environment variables:
3737

38-
*Local EDOT Collector*
38+
```bash
39+
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io
40+
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=ApiKey P....l"
41+
export OTEL_SERVICE_NAME="my-awesome-service"
42+
```
3943

40-
EDOT Collector is accessible with `http://localhost:4318` without authentication, no further configuration is required.
44+
For more advanced configuration, see [Configuration](../configuration) section.
4145

42-
*Self-managed EDOT Collector*
46+
Configuration of those environment values depends on the deployment model:
4347

44-
`OTEL_EXPORTER_OTLP_ENDPOINT` should be set to the OTLP endpoint of your selfmanaged EDOT Collector.
45-
46-
If EDOT Collector requires authentication, `OTEL_EXPORTER_OTLP_HEADERS` should be set to include `Authorization=ApiKey <ELASTIC_API_KEY>` (comma-separated key=value list).
47-
48-
*Elastic Managed OTLP endpoint*
48+
### Local EDOT Collector
4949

50-
Use [these guides](../../../quickstart/serverless/index) to retrieve the `<ELASTIC_OTLP_ENDPOINT>` and the `<ELASTIC_API_KEY>`.
50+
EDOT Collector is accessible with `http://localhost:4318` without authentication, no further configuration is required.
51+
The `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables do not have to be set.
5152

52-
- `OTEL_EXPORTER_OTLP_ENDPOINT` should be set to `<ELASTIC_OTLP_ENDPOINT>`
53-
- `OTEL_EXPORTER_OTLP_HEADERS` should be set to include `Authorization=ApiKey <ELASTIC_API_KEY>` (comma-separated key=value list).
53+
**Self-managed EDOT Collector**
5454

55-
*Kubernetes*
56-
57-
Connection to the EDOT Collector is managed by the OTel Kubernetes Operator, [follow the Quickstart Guides](../../../quickstart/index) for Kubernetes.
55+
`OTEL_EXPORTER_OTLP_ENDPOINT` should be set to the OTLP endpoint of your selfmanaged EDOT Collector.
56+
57+
If EDOT Collector requires authentication, `OTEL_EXPORTER_OTLP_HEADERS` should be set to include `Authorization=ApiKey <ELASTIC_API_KEY>` (comma-separated key=value list).
5858

59+
### Elastic Managed OTLP endpoint
5960

60-
We also recommend setting the `service.name` resource attribute explicitly:
61+
Use [these guides](../../../quickstart/serverless/index) to retrieve the `<ELASTIC_OTLP_ENDPOINT>` and the `<ELASTIC_API_KEY>`.
6162

62-
TODO
63+
- `OTEL_EXPORTER_OTLP_ENDPOINT` should be set to `<ELASTIC_OTLP_ENDPOINT>`
64+
- `OTEL_EXPORTER_OTLP_HEADERS` should be set to include `Authorization=ApiKey <ELASTIC_API_KEY>` (comma-separated key=value list).
6365

64-
Set the `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables. For example:
66+
### Kubernetes
6567

66-
```bash
67-
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io
68-
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=ApiKey P....l"
69-
```
68+
Connection to the EDOT Collector is managed by the OTel Kubernetes Operator, [follow the Quickstart Guides](../../../quickstart/index) for Kubernetes.
7069

71-
For more advanced configuration, see [Configuration](../configuration) section.
70+
## Run the Java agent
7271

73-
2. **Run the Java Agent**
72+
Use the `-javaagent:` JVM argument with the path to agent jar, this requires to modify the JVM arguments and restart
73+
the application.
7474

75-
Use the `-javaagent:` JVM argument with the path to agent jar, this requires to modify the JVM arguments and restart
76-
the application.
75+
```bash
76+
java \
77+
-javaagent:/path/to/agent.jar \
78+
-jar myapp.jar
79+
```
7780

78-
```bash
79-
java \
80-
-javaagent:/path/to/agent.jar \
81-
-jar myapp.jar
82-
```
81+
When modifying the JVM command line arguments is not possible, the `JAVA_TOOL_OPTIONS` environment variable can be used
82+
to provide the `-javaagent:` argument or JVM system properties. When `JAVA_TOOL_OPTIONS` is set, all JVMs will automatically
83+
use it, thus special care should be taken to limit the scope to the relevant JVMs.
8384

84-
For applications deployed with Kubernetes, we recommend using [OpenTelemetry Operator](./k8s).
85+
For applications deployed with Kubernetes, we recommend using [OpenTelemetry Operator](./k8s).

0 commit comments

Comments
 (0)