Skip to content

Code review sweep (run 24964322798)#18319

Merged
trask merged 9 commits into
mainfrom
otelbot/code-review-sweep-24964322798
Apr 26, 2026
Merged

Code review sweep (run 24964322798)#18319
trask merged 9 commits into
mainfrom
otelbot/code-review-sweep-24964322798

Conversation

@otelbot

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

  • guava-10.0:javaagent
  • guava-10.0:library
  • gwt-2.0:javaagent
  • helidon-4.3:javaagent
  • helidon-4.3:library
  • helidon-4.3:testing
  • hibernate-3.3:javaagent
  • hibernate-4.0:javaagent
  • hibernate-6.0:javaagent

Module: guava-10.0:javaagent

Module path: instrumentation/guava-10.0/javaagent

Summary

Reviewed instrumentation/guava-10.0/javaagent and the mandatory instrumentation/guava-10.0/metadata.yaml validation surface; no safe repository-guideline fixes were needed.

Applied Changes

No safe automated changes were applied.

Module: guava-10.0:library

Module path: instrumentation/guava-10.0/library

Summary

Reviewed instrumentation/guava-10.0/library and validated instrumentation/guava-10.0/metadata.yaml; no safe repository-guideline fixes were needed.

Applied Changes

No safe automated changes were applied.

Module: gwt-2.0:javaagent

Module path: instrumentation/gwt-2.0/javaagent

Summary

Applied 2 safe fixes under instrumentation/gwt-2.0/javaagent: corrected the testapp resource directory and reduced GwtSingletons visibility for internal-only javaagent use. metadata.yaml needed no changes because this module does not define instrumentation config, and both required :check runs still hit the same pre-existing GwtTest failure.

Applied Changes

Build

File: build.gradle.kts:27
Change: Changed the `testapp` source set resources path from `src/webapp` to the existing `src/testapp/webapp` directory.
Reason: Repository review rules prioritize deterministic correctness fixes; the previous path did not exist in this module, so the source set was misconfigured.

Style

File: GwtSingletons.java:16
Change: Made `GwtSingletons`, `RPC_CONTEXT_KEY`, and `instrumenter()` package-private.
Reason: The style guide requires minimal necessary visibility, and this helper is only used from the same package inside `javaagent/src/main`.

Unresolved Items

File: GwtTest.java
Reason: Both `./gradlew :instrumentation:gwt-2.0:javaagent:check` and `./gradlew :instrumentation:gwt-2.0:javaagent:check -PtestLatestDeps=true` fail before and after these review fixes because `testGwt()` expects an exception event on `test.gwt.shared.MessageService/sendMessage`, but the exported span has no events; the same runs also end with `1 Advice failures during test`.

Module: helidon-4.3:javaagent

Module path: instrumentation/helidon-4.3/javaagent

Summary

Reviewed instrumentation/helidon-4.3/javaagent, validated the sibling metadata.yaml usage against the module’s standard HTTP-server config wiring, and applied a safe hot-path fix so Helidon response customization now reuses a single HelidonServerResponseMutator instead of allocating one per request.

Applied Changes

[Style]

File: HelidonServerResponseMutator.java:13
Change: Added a shared `INSTANCE` field and a private constructor to make `HelidonServerResponseMutator` reusable.
Reason: The repository singleton guideline for stateless telemetry interfaces keeps a singleton on hot paths; this `HttpServerResponseMutator` is used during per-request response customization, so reusing one instance avoids unnecessary allocations.

File: ResponseCustomizingFilter.java:24
Change: Replaced `new HelidonServerResponseMutator()` with `HelidonServerResponseMutator.INSTANCE` in the filter path.
Reason: The same hot-path exception in the stateless telemetry interface guideline says not to allocate a new mutator on each request when a reusable singleton is sufficient.

Module: helidon-4.3:library

Module path: instrumentation/helidon-4.3/library

Summary

Reviewed instrumentation/helidon-4.3/library and performed the required metadata.yaml validation checks for the Helidon instrumentation module; no safe repository-guideline fixes were needed.

Applied Changes

No safe automated changes were applied.

Module: helidon-4.3:testing

Module path: instrumentation/helidon-4.3/testing

Summary

Applied one safe review fix in instrumentation/helidon-4.3/testing: narrowed unused package-visible helper methods in AbstractHelidonTest to private static to match the repository's minimal-visibility rule.

Applied Changes

Style

File: AbstractHelidonTest.java:33
Change: Changed the three `sendResponse(...)` helper overloads from package-visible to `private static`.
Reason: The style guide requires the most restrictive visibility that still allows the code to function, and these helpers are only called within `AbstractHelidonTest`.

Module: hibernate-3.3:javaagent

Module path: instrumentation/hibernate/hibernate-3.3/javaagent

Summary

Reviewed instrumentation/hibernate/hibernate-3.3/javaagent and applied one safe repository-guideline cleanup: tightened a test-only helper in SessionTest to minimum required visibility. Module validation completed with :instrumentation:hibernate:hibernate-3.3:javaagent:check, :instrumentation:hibernate:hibernate-3.3:javaagent:check -PtestLatestDeps=true, and spotlessApply.

Applied Changes

style

File: SessionTest.java:578
Change: Changed `sessionAssertion(...)` from package-private to `private static`.
Reason: Follows the repository style rule to prefer the narrowest visibility for members that are only used within the declaring class, with no behavior change.

Module: hibernate-4.0:javaagent

Module path: instrumentation/hibernate/hibernate-4.0/javaagent

Summary

Applied 3 safe review fixes in instrumentation/hibernate/hibernate-4.0/javaagent: reordered the EntityNameUtil utility class to match the style guide’s member-ordering rules, and tightened test fixture field visibility/immutability per the minimal-visibility and final-where-possible guidelines.

Applied Changes

Style

File: EntityNameUtil.java:15
Change: Reordered `EntityNameUtil` so the public factory method appears above the private helper, and moved the private utility constructor to the end of the class.
Reason: The style guide says calling methods should appear above the methods they call, and static utility classes should keep the private constructor after all methods.

File: EntityManagerTest.java:53
Change: Changed `entityManagerFactory` from package-private to `private static final`.
Reason: Repository style requires the most restrictive visibility that still works; this test fixture is only used inside `EntityManagerTest`.

File: SpringJpaTest.java:42
Change: Changed `context` and `repo` to `private final` fields.
Reason: The style guide prefers minimal necessary visibility and `final` fields where possible; these per-test fixtures are initialized once and never reassigned.

Module: hibernate-6.0:javaagent

Module path: instrumentation/hibernate/hibernate-6.0/javaagent

Summary

Applied 3 safe review fixes in hibernate-6.0: added the missing metadata.yaml declarative config mapping, removed a dead query matcher branch in SessionInstrumentation, and normalized the single-landmark classLoaderMatcher() comment layout.

Applied Changes

[Config]

File: metadata.yaml:6
Change: Added the missing `declarative_name: java.hibernate.experimental_span_attributes/development` entry for `otel.instrumentation.hibernate.experimental-span-attributes`.
Reason: `knowledge/metadata-yaml-format.md` requires every instrumentation config entry to declare `declarative_name`, and experimental flat properties must map to a declarative key with `/development`.

[Javaagent]

File: SessionInstrumentation.java:85
Change: Removed the extra `.or(named("org.hibernate.query.spi.QueryImplementor"))` branch from the query-return matcher.
Reason: Under the general correctness rules, ineffective matcher logic should be fixed: `named(...)` here matches method names, not return types, so that branch was dead and never widened the advice target set.

File: HibernateInstrumentationModule.java:27
Change: Rewrote the single-class `classLoaderMatcher()` to the compact one-line `hasClassesNamed(...)` form with the version comment above it.
Reason: `knowledge/javaagent-module-patterns.md` prefers the compact comment layout for a single-landmark `classLoaderMatcher()` so the version boundary is documented in the repository’s standard form.


Download code review diagnostics

otelbot Bot added 6 commits April 26, 2026 19:12
Automated code review of instrumentation/gwt-2.0/javaagent.
Automated code review of instrumentation/helidon-4.3/javaagent.
Automated code review of instrumentation/helidon-4.3/testing.
Automated code review of instrumentation/hibernate/hibernate-3.3/javaagent.
Automated code review of instrumentation/hibernate/hibernate-4.0/javaagent.
Automated code review of instrumentation/hibernate/hibernate-6.0/javaagent.
@otelbot otelbot Bot requested a review from a team as a code owner April 26, 2026 19:41
trask added 3 commits April 26, 2026 13:13
ByteBuddy advice with inline=false in GwtRpcInstrumentation references GwtSingletons from instrumented class com.google.gwt.user.server.rpc.RPC, which is in a different package. Making the class and its members package-private caused IllegalAccessError at runtime, breaking GwtTest.
… set

The testapp source set's resources block was never consumed: the webapp files are copied directly via the copyTestWebapp task using from(file("src/testapp/webapp")), independent of the source set. compileGwt only uses java.srcDirs/compileClasspath, and the test classpath only adds build/testapp/classes. Dropping the dead block.
Matches the dominant convention for non-enum HttpServerResponseMutator implementations in this repo (Akka, Pekko, Grizzly, Jetty 8/11/12, Servlet 3/5, Liberty all use 'new XyzResponseMutator()' at the call site) and the default rule in general-rules.md ('Prefer Instance Creation Over Singletons'). Header customization is not a hot path that warrants the singleton exception.
@trask trask enabled auto-merge (squash) April 26, 2026 20:29
@trask trask merged commit ee327a6 into main Apr 26, 2026
178 of 180 checks passed
@trask trask deleted the otelbot/code-review-sweep-24964322798 branch April 26, 2026 21:15
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