Skip to content

Code review sweep (run 24980313637)#18335

Merged
trask merged 10 commits into
mainfrom
otelbot/code-review-sweep-24980313637
Apr 27, 2026
Merged

Code review sweep (run 24980313637)#18335
trask merged 10 commits into
mainfrom
otelbot/code-review-sweep-24980313637

Conversation

@otelbot

@otelbot otelbot Bot commented Apr 27, 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:

  • jetty-httpclient-12.0:library
  • jetty-httpclient-12.0:testing
  • jetty-httpclient-9.2:javaagent
  • jetty-httpclient-9.2:library
  • jetty-httpclient-9.2:testing
  • jetty-11.0:javaagent
  • jetty-12.0:javaagent

Module: jetty-httpclient-12.0:library

Module path: instrumentation/jetty-httpclient/jetty-httpclient-12.0/library

Summary

Applied one safe fix in TracingHttpRequest: added accurate @Nullable annotations for the lazily initialized parent-context path and reduced the constructor to package-private to match the non-public class.

Applied Changes

[Style]

File: TracingHttpRequest.java:24
Change: Annotated `parentContext` and `openScope()` with `@Nullable`, and removed the redundant `public` modifier from the `TracingHttpRequest` constructor.
Reason: The review checklist requires accurate nullability for fields and return values that can actually be `null`, and the style guide requires minimal necessary visibility; `parentContext` is unset until `send()` runs, `openScope()` can return `null`, and a constructor on a package-private class should not be wider than package-private.

Module: jetty-httpclient-12.0:testing

Module path: instrumentation/jetty-httpclient/jetty-httpclient-12.0/testing

Summary

Updated AbstractJettyClient12Test to use an accurate comment for the disabled reused-request scenario; no other safe in-scope review fixes were needed.

Applied Changes

General

File: AbstractJettyClient12Test.java:62
Change: Reworded the reused-request comment to state that Jetty 12 does not support reusing requests and that calling `request.send()` twice blocks indefinitely.
Reason: `knowledge/general-rules.md` says to fix incorrect comments; this keeps the test helper's explanation precise and aligned with the behavior behind `disableTestReusedRequest()`.

Module: jetty-httpclient-9.2:javaagent

Module path: instrumentation/jetty-httpclient/jetty-httpclient-9.2/javaagent

Summary

Applied three safe review fixes for jetty-httpclient-9.2: completed missing supported declarative_name metadata mappings, normalized a non-constant Gradle variable name to lower camel case, and simplified the single-landmark classLoaderMatcher() to the repository-preferred compact form.

Applied Changes

Config

File: metadata.yaml:8
Change: Added missing `declarative_name` entries for the supported flat properties `otel.instrumentation.http.known-methods`, `otel.instrumentation.http.client.capture-request-headers`, `otel.instrumentation.http.client.capture-response-headers`, `otel.instrumentation.http.client.emit-experimental-telemetry`, and `otel.instrumentation.sanitization.url.experimental.sensitive-query-parameters`.
Reason: `metadata-yaml-format.md` requires valid declarative config mappings for supported instrumentation properties; these entries were missing and now match the repository's validated bridge mappings.

Style

File: build.gradle.kts:15
Change: Renamed `jettyVers_base9` to `jettyVersBase9` and updated its only usage.
Reason: The style guide requires lower camel case for non-constant variables; this Gradle version holder was not a constant-style field and should follow repository naming conventions.

Javaagent

File: JettyHttpClient9InstrumentationModule.java:30
Change: Rewrote the single-class `classLoaderMatcher()` to use the compact one-line `hasClassesNamed(...)` form under the version comment.
Reason: `javaagent-module-patterns.md` prefers the compact form for a single landmark class in `classLoaderMatcher()` to keep version-boundary comments concise and consistent.

Module: jetty-httpclient-9.2:library

Module path: instrumentation/jetty-httpclient/jetty-httpclient-9.2/library

Summary

Applied two safe hot-path cleanup fixes in jetty-httpclient-9.2 library; metadata.yaml review found no changes needed, and the required Gradle validation completed cleanly.

Applied Changes

Style

File: JettyClientWrapUtil.java:60
Change: Replaced the `wrapResponseListeners()` stream pipeline with a pre-sized loop and pre-sized the listener-interface list used during proxy wrapping.
Reason: The style guide's performance rule says to avoid unnecessary allocations on the instrumentation hot path; this removes stream-pipeline overhead and avoids repeated `ArrayList` resizing while preserving behavior.

File: JettyClientTracingListener.java:87
Change: Pre-sized the request-listener interface list in `wrapRequestListeners()` to the known maximum interface count.
Reason: The repository performance guidance prefers avoiding avoidable allocations on hot paths; using the known listener-interface count prevents unnecessary `ArrayList` growth during request-time listener wrapping.

Module: jetty-httpclient-9.2:testing

Module path: instrumentation/jetty-httpclient/jetty-httpclient-9.2/testing

Summary

Applied one safe reliability fix in AbstractJettyClient9Test; metadata.yaml review for jetty-httpclient-9.2 did not require any deterministic changes.

Applied Changes

General

File: AbstractJettyClient9Test.java:45
Change: Hardened `@AfterEach` cleanup to handle partial `@BeforeEach` failures and preserve both `HttpClient.stop()` exceptions, and changed HTTPS client selection to use `"https".equalsIgnoreCase(uri.getScheme())`.
Reason: The review checklist requires fixing deterministic correctness issues. This shared test base could throw `NullPointerException` during cleanup after partial setup failure and could skip the second `stop()` call if the first one failed. The style guide also prefers null-safe comparisons, so comparing the constant to `uri.getScheme()` avoids dereferencing a nullable scheme.

Module: jetty-11.0:javaagent

Module path: instrumentation/jetty/jetty-11.0/javaagent

Summary

Applied a safe metadata fix in instrumentation/jetty/jetty-11.0/metadata.yaml by adding the missing declarative_name mappings for all declared config keys and declaring CONTEXT_PROPAGATION to match the Jetty 11 module behavior.

Applied Changes

Config

File: metadata.yaml:6
Change: Added `declarative_name` for each `configurations` entry and added the `CONTEXT_PROPAGATION` feature.
Reason: `metadata-yaml-format.md` requires each metadata config entry to include the correct declarative mapping, and module metadata should accurately declare supported features exposed by the existing instrumentation behavior.

Module: jetty-12.0:javaagent

Module path: instrumentation/jetty/jetty-12.0/javaagent

Summary

Applied safe internal visibility reductions in the jetty-12.0 javaagent; the required metadata.yaml review found no deterministic fixes.

Applied Changes

Style

File: Jetty12Helper.java:17
Change: Reduced `Jetty12Helper` and its helper methods to package-private visibility because they are only used inside the local `v12_0` package.
Reason: The style guide and review checklist require the most restrictive visibility that still works; these javaagent internals are not directly referenced from `@Advice` methods or outside the package.

File: Jetty12ResponseMutator.java:11
Change: Reduced `Jetty12ResponseMutator` to package-private visibility.
Reason: The repository style rule prefers minimal necessary visibility, and this mutator is only instantiated from package-local Jetty 12 instrumentation code.

File: Jetty12Singletons.java:14
Change: Reduced `Jetty12Singletons` and its `helper()` accessor to package-private visibility.
Reason: The style guide requires internal javaagent helpers to avoid broader visibility than needed; both the class and accessor are only used within the same package.


Download code review diagnostics

otelbot Bot added 7 commits April 27, 2026 06:48
Automated code review of instrumentation/jetty-httpclient/jetty-httpclient-12.0/library.
Automated code review of instrumentation/jetty-httpclient/jetty-httpclient-12.0/testing.
Automated code review of instrumentation/jetty-httpclient/jetty-httpclient-9.2/javaagent.
Automated code review of instrumentation/jetty-httpclient/jetty-httpclient-9.2/library.
Automated code review of instrumentation/jetty-httpclient/jetty-httpclient-9.2/testing.
Automated code review of instrumentation/jetty/jetty-11.0/javaagent.
Automated code review of instrumentation/jetty/jetty-12.0/javaagent.
@otelbot otelbot Bot requested a review from a team as a code owner April 27, 2026 07:19
@trask trask enabled auto-merge (squash) April 27, 2026 16:07
@trask trask merged commit 5b99fbf into main Apr 27, 2026
94 checks passed
@trask trask deleted the otelbot/code-review-sweep-24980313637 branch April 27, 2026 16:51
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