Add Elasticsearch Java client plugin for 7.x-9.x#804
Open
Conversation
Add plugin for co.elastic.clients:elasticsearch-java, the modern Elasticsearch Java client that replaces the deprecated REST High Level Client. Covers both 7.x (RestClientTransport.performRequest) and 8.x/9.x (ElasticsearchTransportBase.performRequest) code paths using witness classes for version detection. Tested versions: 7.17.22, 8.5.3, 8.12.2, 8.17.0, 9.0.0. Local verification passed for 8.17.0.
elasticsearch-java 9.0.0 is compiled for JDK 17 (class version 61), so it cannot be tested in the JDK 8 test container. Split into a separate elasticsearch-java-9.x-scenario using Spring Boot 3.x and JDK 17 compiler target, added to plugins-jdk17-test.1.yaml.
Fix jar name in assembly.xml, correct support-version.list, and add to plugins-jdk17-test.1.yaml instead of replacing the JDK 8 scenario entry.
…oconfig - Use ES 9.0.0 server image instead of 8.17.0 for the 9.x scenario - Exclude ElasticsearchClientAutoConfiguration to avoid Spring Boot auto-config conflict with ES Java client constructor changes - Verified locally: 9.0.0 passed
Cover every minor version per test policy: - 7.x: 7.15.2, 7.16.3, 7.17.29 (library started at 7.15) - 8.x: 8.0.1 through 8.19.14 (all 20 minors) - 9.x: 9.0.11, 9.1.12, 9.2.8, 9.3.4
- Add RestClientTransportV1Instrumentation for 7.15.x where RestClientTransport is in co.elastic.clients.base.rest_client (moved to co.elastic.clients.transport.rest_client in 7.16+) - Add TransportPerformRequestV1Interceptor that derives operation names from request class names since Endpoint.id() doesn't exist in 7.15.x - Add separate elasticsearch-java-7.15.x-scenario test (JDK 8) - Remove 7.15.x from main scenario (incompatible imports) - Fix JDK17 workflow: run elasticsearch-java-9.x-scenario instead of duplicating the main scenario
- Use FieldValue.of() instead of query(String) for 7.x compatibility (query(String) shorthand only exists in 8.0+) - Fix 8.16/8.17 versions: use 8.16.6/8.17.10 to match available elasticsearch-rest-client versions - Fix 9.x versions: use 9.0.8/9.1.10/9.2.8/9.3.3 to match available elasticsearch-rest-client versions - All 29 versions verified locally against Maven Central
- Extract index name from Endpoint.requestUrl() and set as db.instance tag - Aligns with existing elasticsearch-5.x/6.x/7.x plugins that capture db.type, db.instance, and db.statement tags - Update all three scenario expectedData.yaml files
- Add ElasticsearchPluginConfig with TRACE_DSL and ELASTICSEARCH_DSL_LENGTH_THRESHOLD (same config keys as existing elasticsearch plugins: plugin.elasticsearch.trace_dsl) - Capture request body via RequestBase.toString() which serializes to JSON, same approach as existing ES 6.x/7.x plugins - Guarded by TRACE_DSL config (default false), with length threshold - Update all three scenario expectedData.yaml files
7.15.x (Sep 2021) had unstable API with different package structure (_core vs core, base.rest_client vs transport.rest_client). The API stabilized from 7.16.0+. Plugin now covers 7.16.x-9.x. All remaining versions verified locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
co.elastic.clients:elasticsearch-java, the modern Elasticsearch Java client that replaces the deprecated REST High Level ClientRestClientTransport.performRequestdirectly) and 8.x/9.x (ElasticsearchTransportBase.performRequest) code paths using witness classes for version detectionRestClient.getNodes()performRequestinterceptor creates ExitSpan withElasticsearch/{endpoint.id()}operation name, db.type=Elasticsearch, SpanLayer.DBco.elastic.clients:elasticsearch-javawas first published at 7.15.0, no earlier versions existTest plan