Skip to content

Commit 9d24842

Browse files
committed
Merge remote-tracking branch 'upstream/main' into declarative-config-thread-details-provider2
# Conflicts: # javaagent-extension-api/src/main/java/io/opentelemetry/javaagent/extension/instrumentation/internal/AgentDistributionConfig.java
2 parents 94a0b5e + c80068c commit 9d24842

2,127 files changed

Lines changed: 29134 additions & 27419 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.fossa.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,6 @@ targets:
346346
- type: gradle
347347
path: ./
348348
target: ':instrumentation:armeria:armeria-grpc-1.14:javaagent'
349-
- type: gradle
350-
path: ./
351-
target: ':instrumentation:async-http-client:async-http-client-1-common:javaagent'
352349
- type: gradle
353350
path: ./
354351
target: ':instrumentation:async-http-client:async-http-client-1.8:javaagent'
@@ -358,6 +355,9 @@ targets:
358355
- type: gradle
359356
path: ./
360357
target: ':instrumentation:async-http-client:async-http-client-2.0:javaagent'
358+
- type: gradle
359+
path: ./
360+
target: ':instrumentation:async-http-client:async-http-client-common-1.8:javaagent'
361361
- type: gradle
362362
path: ./
363363
target: ':instrumentation:aws-lambda:aws-lambda-core-1.0:javaagent'
@@ -427,9 +427,6 @@ targets:
427427
- type: gradle
428428
path: ./
429429
target: ':instrumentation:clickhouse:clickhouse-client-v2-0.8:javaagent'
430-
- type: gradle
431-
path: ./
432-
target: ':instrumentation:couchbase:couchbase-2-common:javaagent'
433430
- type: gradle
434431
path: ./
435432
target: ':instrumentation:couchbase:couchbase-2.0:javaagent'
@@ -448,6 +445,9 @@ targets:
448445
- type: gradle
449446
path: ./
450447
target: ':instrumentation:couchbase:couchbase-3.4:javaagent'
448+
- type: gradle
449+
path: ./
450+
target: ':instrumentation:couchbase:couchbase-common-2.0:javaagent'
451451
- type: gradle
452452
path: ./
453453
target: ':instrumentation:dropwizard:dropwizard-metrics-4.0:javaagent'
@@ -630,10 +630,10 @@ targets:
630630
target: ':instrumentation:jms:jms-common:javaagent'
631631
- type: gradle
632632
path: ./
633-
target: ':instrumentation:jsf:jsf-jakarta-common:javaagent'
633+
target: ':instrumentation:jsf:jsf-common-javax:javaagent'
634634
- type: gradle
635635
path: ./
636-
target: ':instrumentation:jsf:jsf-javax-common:javaagent'
636+
target: ':instrumentation:jsf:jsf-jakarta-common:javaagent'
637637
- type: gradle
638638
path: ./
639639
target: ':instrumentation:jsf:jsf-mojarra-1.2:javaagent'
@@ -835,9 +835,6 @@ targets:
835835
- type: gradle
836836
path: ./
837837
target: ':instrumentation:opentelemetry-api:opentelemetry-api-1.50:javaagent'
838-
- type: gradle
839-
path: ./
840-
target: ':instrumentation:opentelemetry-api:opentelemetry-api-1.52:javaagent'
841838
- type: gradle
842839
path: ./
843840
target: ':instrumentation:opentelemetry-api:opentelemetry-api-1.56:javaagent'
@@ -910,15 +907,9 @@ targets:
910907
- type: gradle
911908
path: ./
912909
target: ':instrumentation:runtime-telemetry:runtime-telemetry-java17:javaagent'
913-
- type: gradle
914-
path: ./
915-
target: ':instrumentation:runtime-telemetry:runtime-telemetry-java17:library'
916910
- type: gradle
917911
path: ./
918912
target: ':instrumentation:runtime-telemetry:runtime-telemetry-java8:javaagent'
919-
- type: gradle
920-
path: ./
921-
target: ':instrumentation:runtime-telemetry:runtime-telemetry-java8:library'
922913
- type: gradle
923914
path: ./
924915
target: ':instrumentation:rxjava:rxjava-1.0:library'
@@ -1095,7 +1086,7 @@ targets:
10951086
target: ':instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-resteasy-3.1:javaagent'
10961087
- type: gradle
10971088
path: ./
1098-
target: ':instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-resteasy-common:javaagent'
1089+
target: ':instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-resteasy-common-3.0:javaagent'
10991090
- type: gradle
11001091
path: ./
11011092
target: ':instrumentation:jaxrs:jaxrs-3.0:jaxrs-3.0-annotations:javaagent'
@@ -1171,9 +1162,6 @@ targets:
11711162
- type: gradle
11721163
path: ./
11731164
target: ':instrumentation:spring:spring-jms:spring-jms-6.0:javaagent'
1174-
- type: gradle
1175-
path: ./
1176-
target: ':instrumentation:spring:spring-web:spring-web-3.1:javaagent'
11771165
- type: gradle
11781166
path: ./
11791167
target: ':instrumentation:spring:spring-web:spring-web-3.1:library'

.github/agents/code-review-and-fix.agent.md

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Always load:
2828

2929
- `docs/contributing/style-guide.md`
3030
- `knowledge/general-rules.md` — review checklist and core rules
31+
- `knowledge/metadata-yaml-format.md`**MANDATORY** for any instrumentation module
3132

3233
Load other knowledge files only when their scope trigger applies.
3334
Use the **Knowledge File** column in the checklist table.
@@ -103,6 +104,10 @@ Scope rules:
103104

104105
### Phase 3: Review and Fix
105106

107+
**Before reviewing source files**: For each instrumentation module in scope, execute the full
108+
`metadata-yaml-format.md` validation procedure on its `metadata.yaml`. This is mandatory
109+
regardless of whether metadata.yaml was modified in the PR.
110+
106111
For each file in scope:
107112

108113
1. Skip non-reviewable files:
@@ -134,6 +139,10 @@ Auto-fix boundaries:
134139

135140
- Safe to fix:
136141
- import cleanup or direct style-guide conformance
142+
**Extra step for shared/common modules**: when the modified file resides in a module
143+
whose directory name contains `-common`, or whose Gradle path ends with `:testing`,
144+
`:library`, or `:bootstrap`, **first search all sibling modules** under the same
145+
instrumentation parent for callers of the type or member before applying the fix.
137146
- normalization of existing `@SuppressWarnings` syntax or placement, but preserve any
138147
accurate explanatory comment attached to the suppression instead of deleting it as
139148
style noise
@@ -147,6 +156,8 @@ Auto-fix boundaries:
147156
already valid AssertJ assertions; do not wrap them in `assertThat(...).isTrue()`
148157
- AssertJ `.as(...)` descriptions and `.withFailMessage(...)` in tests — remove them
149158
and prefer direct assertions whose failure output already exposes the unexpected values
159+
- `@Test` method `throws` clauses — limit them to a single exception type and keep that type as
160+
specific as possible.
150161
- deterministic semconv constant handling aligned with repository rules
151162
- missing test-task wiring patterns with clear canonical form
152163
- missing `testInstrumentation` cross-version references — when a javaagent module belongs
@@ -222,6 +233,10 @@ Auto-fix boundaries:
222233
readers/writers/streams/response bodies).
223234
Do not apply this conversion in non-JUnit helper methods, `@BeforeAll`, or shared
224235
setup code.
236+
- class-scoped resources created in `@BeforeAll` or other shared setup — prefer
237+
`AutoCleanupExtension` with `deferAfterAll(...)` over nested `@AfterAll` cleanup
238+
chains. Do not introduce or keep `AutoCleanupExtension` solely for a single
239+
`deferAfterAll(...)` call — use a plain `@AfterAll` instead.
225240
- `hasAttributesSatisfying(...)` calls in test assertions — replace with
226241
`hasAttributesSatisfyingExactly(...)` because it is more precise (the non-exact
227242
variant silently ignores unexpected attributes)
@@ -240,6 +255,10 @@ Auto-fix boundaries:
240255
- redundant `if (value != null)` guards around `AttributesBuilder.put()` calls —
241256
`put` is a no-op for null values, so remove the conditional and pass the value
242257
directly (same for span, log, and metrics attribute setters).
258+
Apply this only when the guarded value can be passed through directly to the
259+
attribute setter. If the null check is guarding a dereference or other derived
260+
computation, keep the explicit guard instead of rewriting it into a ternary
261+
expression just to pass `null` to `put()`.
243262
**Exception**: when the `AttributeKey` is typed as `Long` and the source value is
244263
`Integer`, the generic overload cannot match (`Integer ≠ Long`), so Java resolves
245264
to the `int` convenience overload `put(AttributeKey<Long>, int)` via auto-unboxing.
@@ -248,6 +267,8 @@ Auto-fix boundaries:
248267
When the value type **matches** the `AttributeKey` type parameter (e.g.,
249268
`Boolean``AttributeKey<Boolean>`, `Long``AttributeKey<Long>`), the generic
250269
`@Nullable T` overload is selected directly, null is safe, and the guard is redundant.
270+
For example, keep `if (view != null) { attributes.put(KEY, view.getClass().getName()); }`
271+
as-is; do not rewrite it to `attributes.put(KEY, view == null ? null : view.getClass().getName())`.
251272
- defensive `if (param == null)` checks on parameters not annotated `@Nullable`
252273
these contradict the framework's nullability contract; remove the guard. Conversely,
253274
add `@Nullable` to a parameter only when `null` is actually passed by callers or an
@@ -284,6 +305,12 @@ Auto-fix boundaries:
284305
add the correctly named/shaped method with the implementation, deprecate the old method
285306
to delegate to the new one, and add a `@deprecated` Javadoc tag naming the replacement.
286307
For stable modules, annotate instead: the fix requires a broader compatibility decision.
308+
**Exception — javaagent modules**: javaagent modules (Gradle path ends with `:javaagent`,
309+
including shared `-common` javaagent modules) are bundled into the agent jar and are not
310+
a public API. Do **not** apply a deprecation cycle; rename or change the API directly
311+
and update all in-repo callers in the same commit. A deprecation cycle is only required
312+
for non-stable modules whose artifacts are published for external consumption (e.g.,
313+
`:library`, `:testing`, `instrumentation-api*`).
287314
- Do not auto-fix (report in the final output instead):
288315
- missing `testExperimental` task — when experimental flags are set unconditionally
289316
on all test tasks instead of being isolated in a dedicated task
@@ -293,9 +320,9 @@ Auto-fix boundaries:
293320
- Never change:
294321
- literal type suffixes (e.g., `200``200L` or vice-versa) — Java widens
295322
automatically; both forms compile identically and the change is noise
296-
- non-capturing lambdas or method references as unnecessary allocations; do not flag or
297-
fix these, because on modern JDKs these are typically cached at the call site rather
298-
than allocated on every invocation
323+
- non-capturing lambdas or method references as allocation issues; do not flag,
324+
fix, or justify changes to these as per-call allocations. On HotSpot /
325+
OpenJDK 8+, these are cached at the call site.
299326

300327
Output content rules:
301328

@@ -386,22 +413,30 @@ Execute these steps strictly in order — do not reorder:
386413
pre-existing failure — note it in the final output but do not block the commit.
387414
5. Never commit code that fails tests you can reproduce locally.
388415

389-
**Testing-module dependent validation**: when any modified module is a `testing` module
390-
(its Gradle path ends with `:testing`), you must **also** run `:check` (both normal and
391-
`-PtestLatestDeps=true`) for every sibling `library` and `javaagent` module under the
392-
same instrumentation parent. `testing` modules contain shared abstract test base classes
393-
consumed by those siblings — changes to visibility, method signatures, or class structure
394-
in the `testing` module can break compilation or tests in dependent modules.
395-
396-
To find siblings, list the parent directory of the `testing` module and look for
416+
**Shared-module dependent validation**: when any modified module is a shared module
417+
consumed by sibling instrumentation modules, you must **also** run `:check` (both normal
418+
and `-PtestLatestDeps=true`) for every sibling `library` and `javaagent` module under the
419+
same instrumentation parent. A module is shared if its Gradle path ends with `:testing`,
420+
or its directory name contains `-common` (e.g., `couchbase-2-common`, `netty-common`),
421+
or it is named `library`, `bootstrap`, or `testing-common`. Changes to visibility,
422+
method signatures, or class structure in a shared module can break compilation or tests
423+
in dependent sibling modules — including failures that compile cleanly but throw
424+
`IllegalAccessError` at runtime inside ByteBuddy advice.
425+
426+
To find siblings, list the parent directory of the shared module and look for
397427
`library/`, `javaagent/`, and any version-variant directories that contain `library/`
398-
or `javaagent/` submodules. Run `:check` for each.
428+
or `javaagent/` submodules. Also check `settings.gradle.kts` for every module under
429+
the same instrumentation group. Run `:check` for each sibling that transitively
430+
depends on the modified shared module.
399431

400432
Example: if you modify files in
401433
`:instrumentation:foo:foo-1.0:testing`, also run `:check` for
402434
`:instrumentation:foo:foo-1.0:library`,
403435
`:instrumentation:foo:foo-1.0:javaagent`, and any version-variant siblings such as
404436
`:instrumentation:foo:foo-2.0:library` if it depends on the `foo-1.0:testing` module.
437+
Likewise, if you modify files in `:instrumentation:couchbase:couchbase-2-common:javaagent`,
438+
also run `:check` for `:instrumentation:couchbase:couchbase-2.0:javaagent` and
439+
`:instrumentation:couchbase:couchbase-2.6:javaagent`.
405440

406441
Do not move on to step 2 until every required `:check` run from this step, including
407442
sibling-module validation and any re-runs after fixes or reverts, has fully completed

.github/agents/code-review.agent.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ For each file in scope:
9191
- PR mode: changed lines only
9292
- File/directory mode: all lines
9393
4. Apply checklist rules (below) and insert comments above offending lines.
94-
5. Do not flag a non-capturing lambda or method reference as an unnecessary allocation,
95-
because on modern JDKs these are typically cached at the call site rather than
96-
allocated on every invocation.
94+
5. Do not flag a non-capturing lambda or method reference as an allocation issue.
95+
On HotSpot / OpenJDK 8+, these are cached at the call site.
9796
6. Flag a missing version-boundary comment on a single-class `hasClassesNamed(...)`
9897
check in `classLoaderMatcher()` only after validating the stated boundary from
9998
repository or upstream evidence. Use `// added in X.Y` for a pure lower bound.

.github/agents/knowledge/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ Load only files relevant to the current scope to reduce noise and avoid over-con
1111
| `api-deprecation-policy.md` | Public API removal, rename, or deprecation; stable vs alpha breaking changes |
1212
| `config-property-stability.md` | `otel.instrumentation.*` property add, remove, rename, or deprecation |
1313
| `general-rules.md` | Always — review checklist table and core rules enforced on every review |
14+
| `metadata-yaml-format.md` | Always — mandatory review of metadata.yaml for config coverage |
1415
| `gradle-conventions.md` | `build.gradle.kts` or `settings.gradle.kts` changes, custom test task registration or wiring |
1516
| `javaagent-advice-patterns.md` | ByteBuddy `@Advice` class or advice-method changes |
1617
| `javaagent-module-patterns.md` | `InstrumentationModule`, `TypeInstrumentation`, `VirtualField`, `CallDepth` |
1718
| `javaagent-singletons-patterns.md` | `*Singletons` holder classes, singleton accessors, callers of singleton accessors/fields |
1819
| `library-patterns.md` | Library instrumentation telemetry, builder, getter, or setter pattern changes |
1920
| `module-naming.md` | New or renamed modules or packages; settings includes |
20-
| `testing-general-patterns.md` | Test files in scope — assertion style, resource cleanup patterns, attribute assertion patterns, `satisfies()` lambda usage |
21+
| `testing-general-patterns.md` | Test files in scope — assertion style, test method signatures and throws clauses, resource cleanup patterns, attribute assertion patterns, `satisfies()` lambda usage |
2122
| `testing-experimental-flags.md` | `testExperimental` task or experimental span-attribute assertions |
2223
| `testing-semconv-stability.md` | Semconv opt-in modes, `emitOld*`/`emitStable*`, `maybeStable`, Semconv test tasks |
2324

.github/agents/knowledge/api-deprecation-policy.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ The CHANGELOG uses distinct headings to distinguish:
1818
- `⚠️ Breaking changes to non-stable APIs` — alpha/non-stable modules (routine)
1919
- `⚠️ Breaking Changes` — stable module changes (rare, requires strong justification)
2020

21+
### Javaagent modules are not a public API
22+
23+
Javaagent modules (Gradle path ends with `:javaagent`, including shared `-common` javaagent
24+
modules) are bundled into the agent jar and are **not** published for external consumption.
25+
Do **not** apply a deprecation cycle to symbols in javaagent modules — rename or change the
26+
API directly and update all in-repo callers in the same commit. The deprecate-then-remove
27+
cycle described below applies only to non-stable modules whose artifacts are published
28+
(e.g., `:library`, `:testing`, `instrumentation-api*`).
29+
2130
## The Deprecate-Then-Remove Cycle
2231

2332
### Alpha (non-stable) modules

0 commit comments

Comments
 (0)