Skip to content

Code review sweep (run 25139405527)#18424

Merged
trask merged 8 commits into
mainfrom
otelbot/code-review-sweep-25139405527
Apr 30, 2026
Merged

Code review sweep (run 25139405527)#18424
trask merged 8 commits into
mainfrom
otelbot/code-review-sweep-25139405527

Conversation

@otelbot

@otelbot otelbot Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Automated code review sweep walked the following modules in order
and stopped after accumulating at least 10 modified files:

  • elasticsearch-rest-5.0:javaagent
  • elasticsearch-rest-6.4:javaagent
  • elasticsearch-rest-7.0:javaagent
  • elasticsearch-rest-7.0:library
  • elasticsearch-rest-common-5.0:javaagent
  • elasticsearch-rest-common-5.0:library
  • elasticsearch-transport-5.0:javaagent
  • elasticsearch-transport-5.3:javaagent

Module: elasticsearch-rest-5.0:javaagent

Module path: instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent

Summary

Applied one safe repository-guideline fix in elasticsearch-rest-5.0 javaagent tests and committed it as Review fixes for elasticsearch-rest-5.0 javaagent.

Applied Changes

Testing

File: ElasticsearchRest5Test.java:48
Change: Replaced separate class-scoped `@AfterAll` cleanup with `AutoCleanupExtension` and `deferAfterAll(...)` registrations next to `ElasticsearchContainer` and `RestClient` creation.
Reason: The repository testing guidance prefers `AutoCleanupExtension.deferAfterAll(...)` for shared resources created in `@BeforeAll`, keeping creation and cleanup together instead of maintaining a separate cleanup chain.

Module: elasticsearch-rest-6.4:javaagent

Module path: instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent

Summary

Applied safe review fixes to elasticsearch-rest-6.4 javaagent tests and committed them in 7cb57ef5.

Applied Changes

Testing

File: ElasticsearchRest6Test.java:47
Change: Replaced manual `@AfterAll` cleanup with `AutoCleanupExtension.deferAfterAll(...)` for `ElasticsearchContainer` and `RestClient`, and changed the async `CountDownLatch.await()` to `assertThat(countDownLatch.await(10, SECONDS)).isTrue()`.
Reason: Repository testing guidance prefers `AutoCleanupExtension` for class-scoped resources created in `@BeforeAll`; bounded async waits with assertions avoid tests hanging indefinitely and match sibling module patterns.

Module: elasticsearch-rest-7.0:javaagent

Module path: instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent

Summary

Applied safe review fixes for elasticsearch-rest-7.0 javaagent and committed them in 5087ac94.

Applied Changes

Style

File: ElasticsearchRest7Singletons.java:22
Change: Moved `ENDPOINT_DEFINITION` above the `instrumenter()` accessor so all static fields are declared before methods.
Reason: Repository style guide class organization prefers static fields before methods, and singleton guidance allows uppercase constant-like `VirtualField` fields to remain directly exposed.

Testing

File: ElasticsearchRest7Test.java:48
Change: Replaced manual `@AfterAll` cleanup with `AutoCleanupExtension.deferAfterAll(...)` for `ElasticsearchContainer` and `RestClient`, and narrowed `elasticsearchStatus()` from `throws Exception` to `throws IOException`.
Reason: Testing guidelines prefer `AutoCleanupExtension.deferAfterAll(...)` for class-scoped resources created in `@BeforeAll`, and `@Test` throws clauses should use the narrowest single checked exception type when clear.

Module: elasticsearch-rest-7.0:library

Module path: instrumentation/elasticsearch/elasticsearch-rest-7.0/library

Summary

Applied one safe repository-guideline fix under instrumentation/elasticsearch/elasticsearch-rest-7.0/library and committed it as 5591e062 (Review fixes for elasticsearch-rest-7.0 library).

Applied Changes

Style

File: RestClientWrapper.java:135
Change: Added `@Nullable` to `getInstrumenter(...)` and imported `javax.annotation.Nullable`.
Reason: Repository nullability guidance requires annotating return types that can actually return `null`; `getInstrumenter(...)` returns `null` when the proxy supplier is absent.

Module: elasticsearch-rest-common-5.0:javaagent

Module path: instrumentation/elasticsearch/elasticsearch-rest-common-5.0/javaagent

Summary

No safe repository-guideline fixes were applied under instrumentation/elasticsearch/elasticsearch-rest-common-5.0/javaagent. The reviewed build.gradle.kts and ElasticsearchRestJavaagentInstrumenterFactory align with existing common javaagent-module patterns, and related Elasticsearch REST metadata.yaml entries match the used config keys and defaults.

Applied Changes

No safe automated changes were applied.

Module: elasticsearch-rest-common-5.0:library

Module path: instrumentation/elasticsearch/elasticsearch-rest-common-5.0/library

Summary

Applied and committed one safe repository-guideline fix for elasticsearch-rest-common-5.0 library instrumentation.

Applied Changes

Semconv

File: ElasticsearchClientAttributeExtractor.java:28
Change: Replaced direct static imports of semconv `AttributeKey` constants with copied local constants such as `HTTP_REQUEST_METHOD`, `SERVER_ADDRESS`, and `URL_FULL`.
Reason: Repository style guide requires library instrumentation to copy semantic convention constants directly instead of depending on semconv constants exposed by the semconv artifact.

Module: elasticsearch-transport-5.0:javaagent

Module path: instrumentation/elasticsearch/elasticsearch-transport-5.0/javaagent

Summary

Applied safe repository-guideline fixes in elasticsearch-transport-5.0 javaagent tests and source; one Gradle sibling-wiring issue remains unresolved because the deterministic fix failed local validation.

Applied Changes

Style

File: Elasticsearch5TransportAttributesGetter.java:26
Change: Normalized annotation order so `@Override` precedes `@Nullable` on `getNetworkPeerPort()`.
Reason: Repository style favors consistent annotation ordering on overridden nullable methods.

Testing

File: Elasticsearch5NodeClientTest.java:51
Change: Replaced the class-scoped `@AfterAll` node close with `cleanup.deferAfterAll(testNode)`.
Reason: Testing guidance prefers `AutoCleanupExtension.deferAfterAll(...)` for class-scoped resources when the extension is already available.

File: Elasticsearch5TransportClientTest.java:52
Change: Replaced the class-scoped `@AfterAll` node close with `cleanup.deferAfterAll(testNode)` and added deferred cleanup for the `TransportClient`.
Reason: Testing guidance prefers `AutoCleanupExtension.deferAfterAll(...)` for class-scoped resources and avoids leaving `AutoCloseable` test clients unclosed.

Unresolved Items

File: build.gradle.kts
Reason: Needs manual fix: Gradle convention requires sibling `testInstrumentation` for `elasticsearch-transport-5.3` and `elasticsearch-transport-6.0`, but adding those entries made `:instrumentation:elasticsearch:elasticsearch-transport-5.0:javaagent:check` fail with muzzle failures from the sibling modules on the Elasticsearch 5.0 test classpath.

Module: elasticsearch-transport-5.3:javaagent

Module path: instrumentation/elasticsearch/elasticsearch-transport-5.3/javaagent

Summary

Applied and committed one safe repository-guideline fix in elasticsearch-transport-5.3 javaagent tests. One build-wiring issue remains unresolved because the deterministic fix caused reproducible :instrumentation:elasticsearch:elasticsearch-transport-5.3:javaagent:check muzzle failures and was reverted.

Applied Changes

Testing

File: ElasticsearchSpringTest.java:8
Change: Replaced repeated `Boolean.getBoolean(...)` reads with a cached `EXPERIMENTAL_ATTRIBUTES` flag in the shared experimental assertion helper.
Reason: `testing-experimental-flags.md` says experimental flags should be hoisted into an `EXPERIMENTAL_ATTRIBUTES` constant and reused by test assertions/helpers.

Unresolved Items

File: build.gradle.kts
Reason: Missing sibling `testInstrumentation` references for `elasticsearch-transport-5.0` and `elasticsearch-transport-6.0` match the `gradle-conventions.md` cross-version rule, but adding them caused `:instrumentation:elasticsearch:elasticsearch-transport-5.3:javaagent:check` to fail with `2 Muzzle failures during test`; the attempted fix was reverted and needs manual investigation.


Download code review diagnostics

otelbot Bot added 7 commits April 29, 2026 23:55
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.
@otelbot otelbot Bot requested a review from a team as a code owner April 30, 2026 00:31
@trask trask enabled auto-merge (squash) April 30, 2026 02:17
@trask trask merged commit e1ea73d into main Apr 30, 2026
94 checks passed
@trask trask deleted the otelbot/code-review-sweep-25139405527 branch April 30, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant