Skip to content

Commit 7d22597

Browse files
authored
Transform inline advice to delegating advice and test indy modules (#9508)
1 parent a347454 commit 7d22597

File tree

80 files changed

+1290
-49
lines changed

Some content is hidden

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

80 files changed

+1290
-49
lines changed

.github/workflows/build-pull-request.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
with:
2222
cache-read-only: true
2323

24+
test-indy:
25+
uses: ./.github/workflows/reusable-test-indy.yml
26+
with:
27+
cache-read-only: true
28+
2429
muzzle:
2530
uses: ./.github/workflows/reusable-muzzle.yml
2631
with:
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Reusable - Test latest deps
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cache-read-only:
7+
type: boolean
8+
required: false
9+
no-build-cache:
10+
type: boolean
11+
required: false
12+
secrets:
13+
GRADLE_ENTERPRISE_ACCESS_KEY:
14+
required: false
15+
GE_CACHE_USERNAME:
16+
required: false
17+
GE_CACHE_PASSWORD:
18+
required: false
19+
20+
jobs:
21+
test-indy:
22+
name: testIndy${{ matrix.test-partition }}
23+
if: ${{ contains(github.event.pull_request.labels.*.name, 'test indy') }}
24+
runs-on: ubuntu-latest
25+
strategy:
26+
matrix:
27+
test-partition:
28+
- 0
29+
- 1
30+
- 2
31+
- 3
32+
fail-fast: false
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Free disk space
37+
run: .github/scripts/gha-free-disk-space.sh
38+
39+
- name: Set up JDK for running Gradle
40+
uses: actions/setup-java@v3
41+
with:
42+
distribution: temurin
43+
java-version: 17.0.6
44+
45+
- name: Increase gradle daemon heap size
46+
run: |
47+
sed -i "s/org.gradle.jvmargs=/org.gradle.jvmargs=-Xmx3g /" gradle.properties
48+
49+
# vaadin 14 tests fail with node 18
50+
- name: Set up Node
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: 16
54+
55+
# vaadin tests use pnpm
56+
- name: Cache pnpm modules
57+
uses: actions/cache@v3
58+
with:
59+
path: ~/.pnpm-store
60+
key: ${{ runner.os }}-test-latest-cache-pnpm-modules
61+
62+
- name: List tests
63+
env:
64+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
65+
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
66+
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
67+
uses: gradle/gradle-build-action@v2
68+
with:
69+
arguments: >
70+
check -x spotlessCheck
71+
listTestsInPartition
72+
-PtestPartition=${{ matrix.test-partition }}
73+
cache-read-only: true
74+
75+
- name: Set test tasks
76+
run: |
77+
echo "test-tasks=$(cat test-tasks.txt | xargs echo | sed 's/\n/ /g')" >> $GITHUB_ENV
78+
79+
- name: Test
80+
uses: gradle/gradle-build-action@v2
81+
env:
82+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
83+
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
84+
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
85+
with:
86+
arguments: >
87+
${{ env.test-tasks }}
88+
-PtestIndy=true
89+
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
90+
cache-read-only: ${{ inputs.cache-read-only }}
91+
# gradle enterprise is used for the build cache
92+
gradle-home-cache-excludes: caches/build-cache-1

conventions/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class JavaagentTestArgumentsProvider(
8686
// in smoke tests instead.
8787
"-Dotel.javaagent.add-thread-details=false",
8888
"-Dotel.metrics.exporter=otlp",
89+
"-Dotel.javaagent.experimental.indy=${findProperty("testIndy") == "true"}",
8990
// suppress repeated logging of "No metric data to export - skipping export."
9091
// since PeriodicMetricReader is configured with a short interval
9192
"-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.io.opentelemetry.sdk.metrics.export.PeriodicMetricReader=INFO",

instrumentation/akka/akka-actor-fork-join-2.5/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkaactor/AkkaForkJoinPoolInstrumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public void transform(TypeTransformer transformer) {
4848
public static class SetAkkaForkJoinStateAdvice {
4949

5050
@Advice.OnMethodEnter(suppress = Throwable.class)
51-
public static PropagatedContext enterJobSubmit(
52-
@Advice.Argument(value = 0, readOnly = false) ForkJoinTask<?> task) {
51+
public static PropagatedContext enterJobSubmit(@Advice.Argument(0) ForkJoinTask<?> task) {
5352
Context context = Java8BytecodeBridge.currentContext();
5453
if (ExecutorAdviceHelper.shouldPropagateContext(context, task)) {
5554
VirtualField<ForkJoinTask<?>, PropagatedContext> virtualField =

instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/AbstractAwsSdkInstrumentationModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public boolean isHelperClass(String className) {
2828
return className.startsWith("io.opentelemetry.contrib.awsxray.");
2929
}
3030

31+
@Override
32+
public boolean isIndyModule() {
33+
return false;
34+
}
35+
3136
@Override
3237
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
3338
// We don't actually transform it but want to make sure we only apply the instrumentation when

instrumentation/aws-sdk/aws-sdk-1.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v1_11/AwsSdkInstrumentationModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public boolean isHelperClass(String className) {
2323
return className.startsWith("io.opentelemetry.contrib.awsxray.");
2424
}
2525

26+
@Override
27+
public boolean isIndyModule() {
28+
return false;
29+
}
30+
2631
@Override
2732
public List<TypeInstrumentation> typeInstrumentations() {
2833
return asList(

instrumentation/aws-sdk/aws-sdk-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awssdk/v2_2/AbstractAwsSdkInstrumentationModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public boolean isHelperClass(String className) {
2727
return className.startsWith("io.opentelemetry.contrib.awsxray.");
2828
}
2929

30+
@Override
31+
public boolean isIndyModule() {
32+
return false;
33+
}
34+
3035
@Override
3136
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
3237
// We don't actually transform it but want to make sure we only apply the instrumentation when

instrumentation/azure-core/azure-core-1.14/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/azurecore/v1_14/AzureSdkInstrumentationModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public void registerHelperResources(HelperResourceBuilder helperResourceBuilder)
3535
"azure-core-1.14/META-INF/services/com.azure.core.util.tracing.Tracer");
3636
}
3737

38+
@Override
39+
public boolean isIndyModule() {
40+
return false;
41+
}
42+
3843
@Override
3944
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
4045
return hasClassesNamed("com.azure.core.util.tracing.Tracer")

instrumentation/azure-core/azure-core-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/azurecore/v1_19/AzureSdkInstrumentationModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public void registerHelperResources(HelperResourceBuilder helperResourceBuilder)
3535
"azure-core-1.19/META-INF/services/com.azure.core.util.tracing.Tracer");
3636
}
3737

38+
@Override
39+
public boolean isIndyModule() {
40+
return false;
41+
}
42+
3843
@Override
3944
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
4045
// this class was introduced in azure-core 1.19

instrumentation/azure-core/azure-core-1.36/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/azurecore/v1_36/AzureSdkInstrumentationModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public void registerHelperResources(HelperResourceBuilder helperResourceBuilder)
3737
"azure-core-1.36/META-INF/services/com.azure.core.util.tracing.Tracer");
3838
}
3939

40+
@Override
41+
public boolean isIndyModule() {
42+
return false;
43+
}
44+
4045
@Override
4146
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
4247
// this class was introduced in azure-core 1.36

0 commit comments

Comments
 (0)