Skip to content

Commit fc6b985

Browse files
Merge pull request elastic#90 from SylvainJuge/java-setup
document otel java setup
2 parents 80da5d3 + 68785c6 commit fc6b985

File tree

5 files changed

+66
-9
lines changed

5 files changed

+66
-9
lines changed

docs/_edot-sdks/java/configuration.md

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ parent: EDOT Java
77

88
# Configuring the EDOT Java Agent
99

10+
EDOT Java instrumentation agent is based on OpenTelemetry Java [SDK](https://github.com/open-telemetry/opentelemetry-java) and [Instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation), and thus supports the following
11+
configuration options:
12+
- [OpenTelemetry Java instrumentation configuration options](https://opentelemetry.io/docs/zero-code/java/agent/configuration/)
13+
- [OpenTelemetry Java SDK configuration options](https://opentelemetry.io/docs/languages/java/configuration/)
14+
1015
TODO:
1116
- describe the EDOT Java specific config options
1217
- describe crucial upstream options

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

+46-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,49 @@ parent: EDOT Java
77

88
# Setting up the EDOT Java Agent
99

10-
TODO:
11-
- where to download
12-
- explicit description of basic setup here (even if it overlaps with upstream docs)
13-
- link to upstream docs for more advanced setup use cases
10+
## Download
11+
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)
13+
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)
15+
16+
## Prerequisites
17+
18+
You need to have completed the steps in the [Quickstart](/quickstart/) section that corresponds to your Elastic deployment model.
19+
20+
## Run
21+
22+
Use the `-javaagent:` JVM argument with the path to agent jar, this requires to modify the JVM arguments and restart
23+
the application.
24+
25+
```bash
26+
java \
27+
-javaagent:/path/to/agent.jar \
28+
-jar myapp.jar
29+
```
30+
31+
For applications deployed with Kubernetes, we recommend using [OpenTelemetry Operator](./k8s).
32+
33+
## Minimal configuration
34+
35+
The minimal configuration to send data involves setting the values for `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS` environment variables.
36+
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).
47+
48+
For example:
49+
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+
```
54+
55+
For more advanced configuration, see [Configuration](../configuration) section.

docs/quickstart/serverless/hosts_vms.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ logs and application traces and send the data through OTLP to your Elastic Serve
2424

2525
Retrieve the `Elastic OTLP Endpoint` and the `Elastic API Key` for your Serverless Project by [following these instructions](./#retrieving-connection-details-for-your-serverless-project).
2626

27-
Replace `<ELASTIC_OTLP_ENDPOINT>` and `<ELASTIC_API_KEY>` before applying the below command.
27+
Replace `<ELASTIC_OTLP_ENDPOINT>` and `<ELASTIC_API_KEY>` before applying the command below.
2828

2929
*Linux*
3030

@@ -57,11 +57,12 @@ logs and application traces and send the data through OTLP to your Elastic Serve
5757
```
5858

5959
3. **Run the EDOT Collector**
60-
61-
Execute the following command to run the EDOT Collector.
6260

6361
{: .note }
64-
The Collector will open the ports `4317` and `4318` to receive application data from locally running OTel SDKs.
62+
The Collector will open the ports `4317` and `4318` to receive application data from locally running OTel SDKs without authentication.
63+
This allows the SDKs to send data without any further configuration needed as they use this endpoint by default.
64+
65+
Execute the following command to run the EDOT Collector.
6566

6667
*Linux / MacOS*
6768

docs/quickstart/serverless/index.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ parent: Quickstart
2424
--> https://my-prj-a1b2c3<b>.ingest.</b>eu-west-1.aws.elastic.cloud
2525
</code></pre>
2626

27+
This URL will be referred to as `ELASTIC_OTLP_ENDPOINT`, and API key (see below) will be required to use it.
28+
2729
2. **Create an API key**
2830

29-
Create an API Key following [these instructions](https://www.elastic.co/guide/en/kibana/current/api-keys.html){:target="_blank"}.
31+
Create an API Key following [these instructions](https://www.elastic.co/guide/en/kibana/current/api-keys.html){:target="_blank"}.
32+
33+
This API key will be referred to as `ELASTIC_API_KEY`.

docs/quickstart/serverless/k8s.md

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ logs collection and application monitoring.
4646
--values 'https://raw.githubusercontent.com/elastic/elastic-agent/refs/tags/v{{ site.edot_versions.collector }}/deploy/helm/edot-collector/kube-stack/managed_otlp/values.yaml' \
4747
--version '0.3.9'
4848
```
49+
50+
The Operator will provide a deployment of the EDOT Collector and provide the configuration environment variables, thus enabling SDKs and instrumentation to send data to the EDOT Collector without further configuration.
51+
4952
4. **Auto-instrument Applications**
5053

5154
Add a language-specific annotation to your namespace by replacing `<LANGUAGE>` with one of the supported values (`nodejs`, `java`, `python`, `dotnet` or `go`) in the below command.
@@ -54,6 +57,8 @@ logs collection and application monitoring.
5457
kubectl annotate namespace YOUR_NAMESPACE instrumentation.opentelemetry.io/inject-<LANGUAGE>="opentelemetry-operator-system/elastic-instrumentation"
5558
```
5659

60+
The OpenTelemetry Operator will automatically provide the OTLP endpoint configuration and authentication to the SDKs through environment variables.
61+
5762
Restart your deployment to ensure the annotations and auto-instrumentations are applied.
5863

5964
For languages where auto-instrumentation is not available, you will need to manually instrument your application. See the [Setup section in the corresponding SDK](../../edot-sdks).

0 commit comments

Comments
 (0)