Skip to content

Commit 3807a20

Browse files
Add documentation section for Elasticsearch Java client (8.x/9.x) search query capture in EDOT Java SDK (#878)
* Documents Elasticsearch search query capture config * Apply comments * Add link to Java client documentation * Link update
1 parent 37834d1 commit 3807a20

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

docs/docset.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ cross_links:
55
- elastic-agent
66
- apm-agent-java
77
- elastic-otel-java
8+
- elasticsearch-java
89
toc:
910
- toc: release-notes
1011
- toc: reference/edot-java

docs/reference/edot-java/configuration.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,49 @@ This table only contains minimal configuration, see each respective feature for
7676
| `ELASTIC_OTEL_JAVAAGENT_LOG_LEVEL` | `INFO` | [Agent logging](#agent-logging) | 1.5.0+ |
7777
| `ELASTIC_OTEL_VERIFY_SERVER_CERT` | `true` | [Exporter certificate verification](#exporter-certificate-verification) | 1.5.0+ |
7878

79+
80+
## Elasticsearch Java client: Capturing search request bodies
81+
```{applies_to}
82+
stack: ga 9.0, ga 8.0
83+
```
84+
85+
When using the {{es}} Java API client, spans for {{es}} operations are generated directly by the client’s built-in OpenTelemetry instrumentation.
86+
87+
Because the client owns the instrumentation, certain fields, such as the search request body reported as `span.db.statement`, are only captured when the {{es}} client’s OpenTelemetry options are turned on.
88+
89+
For more details on instrumentation settings in the {{es}} Java API client, refer to the [{{es}} Java client documentation](elasticsearch-java://reference/index.md).
90+
91+
### When this applies
92+
93+
You might need this configuration if you notice that `span.db.statement` is missing for {{es}} search operations and you use:
94+
95+
* {{es}} Java API client 8.x or 9.x
96+
97+
* EDOT Java SDK or another OpenTelemetry Java SDK
98+
99+
* The {{product.apm-agent-java}}
100+
101+
### Turn on search query capture
102+
103+
Set either one of the following {{es}} client instrumentation options:
104+
105+
#### JVM system property
106+
107+
```bash
108+
-Dotel.instrumentation.elasticsearch.capture-search-query=true
109+
```
110+
111+
#### Environment variable
112+
113+
```bash
114+
OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY=true
115+
```
116+
117+
The flag `otel.instrumentation.elasticsearch.enabled` is turned on by default, so you typically only need to activate `capture-search-query`.
118+
119+
When activated, the {{es}} client includes the search request body in the generated spans, and EDOT or OTel exports this value as `span.db.statement`.
120+
121+
79122
## Central configuration
80123

81124
```{applies_to}

0 commit comments

Comments
 (0)