Code review sweep (run 24952355964)#18313
Merged
Merged
Conversation
Automated code review of instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent.
Automated code review of instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent.
Automated code review of instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent.
Automated code review of instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent.
Automated code review of instrumentation/elasticsearch/elasticsearch-rest-7.0/library.
Automated code review of instrumentation/elasticsearch/elasticsearch-rest-common-5.0/library.
Automated code review of instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent.
Automated code review of instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent.
trask
approved these changes
Apr 26, 2026
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.
Automated code review sweep walked the following modules in order
and stopped after accumulating at least 10 modified files:
couchbase-3.1.6:tracing-opentelemetry-shadedelasticsearch-api-client-7.16:javaagentelasticsearch-api-client-7.16:javaagent-unit-testselasticsearch-rest-5.0:javaagentelasticsearch-rest-6.4:javaagentelasticsearch-rest-7.0:javaagentelasticsearch-rest-7.0:libraryelasticsearch-rest-common-5.0:javaagentelasticsearch-rest-common-5.0:libraryelasticsearch-transport-5.0:javaagentelasticsearch-transport-5.3:javaagentModule:
couchbase-3.1.6:tracing-opentelemetry-shadedModule path:
instrumentation/couchbase/couchbase-3.1.6/tracing-opentelemetry-shadedSummary
Reviewed
instrumentation/couchbase/couchbase-3.1.6/tracing-opentelemetry-shadedand its parentmetadata.yaml; no safe repository-guideline fixes were needed.Applied Changes
No safe automated changes were applied.
Module:
elasticsearch-api-client-7.16:javaagentModule path:
instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagentSummary
Applied one safe review fix by updating the native-instrumentation exclusion comment in
ElasticsearchApiClientInstrumentationModule.javato the repo'sclassLoaderMatcher()artifact-presence-gate form. I left thebuild.gradle.ktsassertInverseissue unresolved because the deterministic fix caused:muzzleto generate duplicate inverse configurations for the splitelasticsearch-javapass ranges.Applied Changes
Javaagent
File:
ElasticsearchApiClientInstrumentationModule.java:30Change: Reworded the negated `hasClassesNamed(...)` comment in `classLoaderMatcher()` to the explicit `artifact presence gate` form and identified `co.elastic.clients:elasticsearch-java 8.10` as the version boundary for native OpenTelemetry support.
Reason: Repository `javaagent-module-patterns.md` requires existing `classLoaderMatcher()` landmark checks that exclude newer native-instrumented versions to use precise version-boundary comments, including the `artifact presence gate` form for native-support exclusions.
Unresolved Items
File:
build.gradle.ktsReason: The two bounded `muzzle` `pass` ranges for `co.elastic.clients:elasticsearch-java` still do not have `assertInverse.set(true)`. Adding `assertInverse` to both ranges made `:instrumentation:elasticsearch:elasticsearch-api-client-7.16:javaagent:muzzle` fail with `Cannot add a configuration with name 'muzzle-AssertFail-co.elastic.clients-elasticsearch-java-7.15.0' as a configuration with that name already exists`, so this needs a manual muzzle-configuration change that preserves the repo guideline without creating duplicate inverse configs.
Module:
elasticsearch-api-client-7.16:javaagent-unit-testsModule path:
instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent-unit-testsSummary
Reviewed all files under
instrumentation/elasticsearch/elasticsearch-api-client-7.16/javaagent-unit-testsplus the modulemetadata.yamland found no safe repository-guideline fixes to apply.Applied Changes
No safe automated changes were applied.
Module:
elasticsearch-rest-5.0:javaagentModule path:
instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagentSummary
Applied one safe
javaagentfix inelasticsearch-rest-5.0: the async exit advice now handles a nullable@Advice.Entervalue before reading the saved scope state.Applied Changes
Javaagent
File:
RestClientInstrumentation.java:105Change: Annotated the async `stopSpan` advice's `@Advice.Enter` array as `@Nullable` and returned early when ByteBuddy supplies a `null` default.
Reason: `@Advice.OnMethodExit` with `suppress = Throwable.class` must tolerate a `null` `@Advice.Enter` value when enter advice fails; this follows the repository `Advice`/nullability guidance and avoids an otherwise suppressed exit-advice `NullPointerException`.
Module:
elasticsearch-rest-6.4:javaagentModule path:
instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagentSummary
Applied 2 safe review fixes under
instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent: guarded nullable@Advice.Enterstate in async exit advice and reduced unnecessary visibility on the local singleton helper after confirmingmetadata.yamlmatches the module's shared config usage.Applied Changes
Javaagent
File:
RestClientInstrumentation.java:103Change: Annotated `@Advice.Enter` `enterResult` as `@Nullable` and returned early when it is `null` before reading the array in `stopSpan()`.
Reason: `@Advice` exit state can be `null` when enter advice is suppressed; sibling Elasticsearch modules already guard this path, and the javaagent advice guideline requires avoiding runtime exceptions in instrumentation code.
Style
File:
ElasticsearchRest6Singletons.java:13Change: Changed `ElasticsearchRest6Singletons` and its `instrumenter()` accessor from `public` to package-private.
Reason: The style guide requires minimal necessary visibility, and this helper is only referenced from the same javaagent package.
Module:
elasticsearch-rest-7.0:javaagentModule path:
instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagentSummary
Reviewed
instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagentand its adjacentmetadata.yaml; applied one safe test fix inElasticsearchRest7Testto clean up the sharedRestClientin@AfterAlland make the async test assert that its timed wait actually completes.Applied Changes
[Testing]
File:
ElasticsearchRest7Test.java:81Change: Closed the shared `RestClient` in `@AfterAll` and replaced the ignored `CountDownLatch.await(10, SECONDS)` result with `assertThat(...).isTrue()` in the async test.
Reason: The review checklist's testing and general-correctness rules require class-scoped test resources to be cleaned up explicitly and prefer direct assertions over ignored results so async tests fail deterministically instead of leaking resources or timing out later with less-clear failures.
Module:
elasticsearch-rest-7.0:libraryModule path:
instrumentation/elasticsearch/elasticsearch-rest-7.0/librarySummary
Applied 2 safe fixes in
elasticsearch-rest-7.0library: exposed the existingcaptureSearchQuerycapability on the public builder and tightened the module test to use a narrower checked exception plus a direct async failure assertion.Applied Changes
Library
File:
ElasticsearchRest7TelemetryBuilder.java:33Change: Added `setCaptureSearchQuery(boolean)` and wired `build()` to pass the configured value instead of hardcoding `false`.
Reason: `library-patterns.md` expects user-facing library builders to expose supported customization knobs; the shared instrumenter already supports `captureSearchQuery`, so hardcoding `false` left that capability inaccessible from the `library` API.
Testing
File:
ElasticsearchRest7Test.java:81Change: Changed `elasticsearchStatus()` to `throws IOException` and replaced the async callback exception rethrow with `assertThat(asyncRequest.getException()).isNull()`.
Reason: `testing-general-patterns.md` says `@Test` methods should use the narrowest practical checked exception type, and direct AssertJ assertions are the preferred test style over manual failure plumbing when validating async results.
Module:
elasticsearch-rest-common-5.0:javaagentModule path:
instrumentation/elasticsearch/elasticsearch-rest-common-5.0/javaagentSummary
No safe repository-guideline fixes were needed under
instrumentation/elasticsearch/elasticsearch-rest-common-5.0/javaagent; the reviewedbuild.gradle.ktsandElasticsearchRestJavaagentInstrumenterFactory.javaalready match the applicable style, config, and module-pattern rules, and the shared Elasticsearch REST metadata coverage forotel.instrumentation.elasticsearch.capture-search-queryis already present and consistent.Applied Changes
No safe automated changes were applied.
Module:
elasticsearch-rest-common-5.0:libraryModule path:
instrumentation/elasticsearch/elasticsearch-rest-common-5.0/librarySummary
Applied 1 safe review fix in
instrumentation/elasticsearch/elasticsearch-rest-common-5.0/library: moved the private constructor inElasticsearchRestInstrumenterFactorybelow its static factory method to match the repository style rule for static utility classes. The related Elasticsearchmetadata.yamlentries already matched the shared config usage, so no metadata change was needed.Applied Changes
Style
File:
ElasticsearchRestInstrumenterFactory.java:24Change: Moved the private constructor below `create()` in the static utility class `ElasticsearchRestInstrumenterFactory`.
Reason: `docs/contributing/style-guide.md` requires private constructors in static utility classes to be placed after all methods; this is a safe repository-style conformance fix.
Module:
elasticsearch-transport-5.0:javaagentModule path:
instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagentSummary
Applied 1 safe fix in
instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent: reduced unnecessary API surface inElasticsearch5TransportSingletons. An attempted siblingtestInstrumentationaddition was not kept because it introduced muzzle failures against the5.0test target; the final tree only contains the safe visibility cleanup.Applied Changes
encapsulation
File:
Elasticsearch5TransportSingletons.java:13Change: Changed `Elasticsearch5TransportSingletons` and its `instrumenter()` accessor from `public` to package-private.
Reason: Repository style guidance prefers the narrowest safe visibility for javaagent-internal helpers; this class is only used within its package, so exposing it publicly was unnecessary.
Module:
elasticsearch-transport-5.3:javaagentModule path:
instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagentSummary
Applied 5 safe review fixes in
elasticsearch-transport-5.3and committed them. The remaining open item isbuild.gradle.kts, where siblingtestInstrumentationwiring appeared to matchgradle-conventions.mdbut causedMuzzletest failures when tried locally, so it was left unchanged.Applied Changes
Config
File:
metadata.yaml:14Change: Added `elasticsearch.request.write.routing` to the `otel.instrumentation.elasticsearch.experimental-span-attributes` description.
Reason: `metadata-yaml-format.md` requires module metadata to match the configuration-driven behavior; this module emits `elasticsearch.request.write.routing`, so the documented attribute list needed to include it.
Style
File:
Elasticsearch53TransportExperimentalAttributesExtractor.java:14Change: Reduced `Elasticsearch53TransportExperimentalAttributesExtractor` from `public` to package-private.
Reason: The style guide requires minimal necessary visibility, and this extractor is only used inside the same package by the module singletons.
File:
Elasticsearch53TransportSingletons.java:13Change: Reduced `Elasticsearch53TransportSingletons` and its `instrumenter()` accessor to package-private.
Reason: The style guide and `javaagent-singletons-patterns.md` prefer the most restrictive visibility that still supports in-package callers; these helpers are not used outside the package.
Testing
File:
Elasticsearch53SpringRepositoryTest.java:78Change: Replaced iterator-based emptiness checks with `assertThat(...).isEmpty()` assertions.
Reason: `testing-general-patterns.md` prefers idiomatic AssertJ collection assertions over manual `iterator().hasNext()` checks.
File:
Elasticsearch53SpringTemplateTest.java:148Change: Switched class-scoped `Node` cleanup from `@AfterAll` to `autoCleanup.deferAfterAll(testNode)` and removed the redundant `@AfterAll` method.
Reason: `testing-general-patterns.md` prefers `AutoCleanupExtension.deferAfterAll(...)` for class-scoped resources when an `AutoCleanupExtension` is already present.
Unresolved Items
File:
build.gradle.ktsReason: Adding sibling `testInstrumentation` entries for `elasticsearch-transport-5.0` and `elasticsearch-transport-6.0` looked consistent with `gradle-conventions.md`, but it caused `2 Muzzle failures during test` in `:instrumentation:elasticsearch:elasticsearch-transport-5.3:javaagent:check`, so the change was reverted and needs manual investigation before applying the cross-version wiring rule here.
Download code review diagnostics