Skip to content

Commit 57d918a

Browse files
committed
Documents Elasticsearch search query capture config
1 parent 3842914 commit 57d918a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

docs/reference/edot-java/configuration.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,47 @@ 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 enabled.
88+
89+
### When this applies
90+
91+
You may need this configuration if you notice that `span.db.statement` is missing for {{es}} search operations and you use:
92+
93+
* {{es}} Java API client 8.x or 9.x
94+
95+
* EDOT Java SDK or another OpenTelemetry Java SDK
96+
97+
* The {{product.apm-agent-java}}
98+
99+
### Enable search query capture
100+
101+
Set either one of the following {{es}} client instrumentation options:
102+
103+
* JVM system property
104+
105+
```bash
106+
-Dotel.instrumentation.elasticsearch.capture-search-query=true
107+
```
108+
109+
* Environment variable
110+
111+
```bash
112+
OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY=true
113+
```
114+
115+
The flag `otel.instrumentation.elasticsearch.enabled` is enabled by default, so you typically only need to enable `capture-search-query`.
116+
117+
When enabled, the {{es}} client includes the search request body in the generated spans, and EDOT or OTel will export this value as `span.db.statement`.
118+
119+
79120
## Central configuration
80121

81122
```{applies_to}

0 commit comments

Comments
 (0)