From ba4b80b8462cd4a66126b978d6c1eb3121a10fa9 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Wed, 22 Jan 2025 09:45:52 +0100 Subject: [PATCH 01/14] Test with jdk 24 ea --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90a698be19..8ca8c70929 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -310,6 +310,8 @@ jobs: distribution: 'temurin' - version: 23 distribution: 'temurin' + - version: 24-ea + distribution: 'temurin' steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/maven-goal-jdk From 07efdb388488caa4adc915cadbe604e4315b6dc4 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:31:33 +0200 Subject: [PATCH 02/14] test with java 24 GA and remove 23 --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1061663aef..19b672ea9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -308,9 +308,7 @@ jobs: distribution: 'temurin' - version: 21 distribution: 'temurin' - - version: 23 - distribution: 'temurin' - - version: 24-ea + - version: 24 distribution: 'temurin' steps: - uses: actions/checkout@v4 From 5fd986a65f1b23ecb69eba376d2591d147088cfc Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:45:34 +0200 Subject: [PATCH 03/14] update test as 24 has been released --- .../src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java index 32ff667b51..50273003a3 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/util/JdkVersionTest.java @@ -33,7 +33,6 @@ public class JdkVersionTest { private static List releaseSchedule() { // from https://www.oracle.com/java/technologies/java-se-support-roadmap.html return List.of( - Arguments.of(24, LocalDate.parse("2025-04-01")), Arguments.of(25, LocalDate.parse("2025-10-01")), Arguments.of(26, LocalDate.parse("2026-04-01")) ); From 71c802a9c1d966e2f30b774bf6f561a7d81cce2e Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:45:45 +0200 Subject: [PATCH 04/14] add java 25 early access as well --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 19b672ea9d..4c53347db9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -310,6 +310,8 @@ jobs: distribution: 'temurin' - version: 24 distribution: 'temurin' + - version: '25-ea' + distribution: 'temurin' steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/maven-goal-jdk From 14faaca1a5776cf3d29f6f84a96970250d944832 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 2 Apr 2025 13:44:11 +0200 Subject: [PATCH 05/14] try to remove jacoco --- pom.xml | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/pom.xml b/pom.xml index 581ff90879..8a5151d9da 100644 --- a/pom.xml +++ b/pom.xml @@ -475,30 +475,6 @@ - - org.jacoco - jacoco-maven-plugin - - - **/*.esclazz - **/*.jar - - - - - - prepare-agent - - - - report - test - - report - - - - com.mycila @@ -593,11 +569,6 @@ maven-enforcer-plugin 3.0.0-M1 - - org.jacoco - jacoco-maven-plugin - 0.8.8 - org.codehaus.mojo license-maven-plugin From f9e2343a57f4316aeefbe0a81acc70addde0db88 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Mon, 26 May 2025 13:43:24 +0200 Subject: [PATCH 06/14] Add CheckClassAdapter to analyze bytecode verification erros --- apm-agent-core/pom.xml | 5 +++ .../apm/agent/bci/ElasticApmAgent.java | 39 ++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index f2207fbd4c..dca90c4e41 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -89,6 +89,11 @@ asm-tree ${version.asm} + + org.ow2.asm + asm-util + ${version.asm} + org.hdrhistogram HdrHistogram diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java index 9f60cf3363..b529d0b01b 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java @@ -18,8 +18,6 @@ */ package co.elastic.apm.agent.bci; -import co.elastic.apm.agent.sdk.internal.PluginClassLoaderRootPackageCustomizer; -import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory; import co.elastic.apm.agent.bci.bytebuddy.ErrorLoggingListener; import co.elastic.apm.agent.bci.bytebuddy.FailSafeDeclaredMethodsCompiler; import co.elastic.apm.agent.bci.bytebuddy.InstallationListenerImpl; @@ -29,7 +27,6 @@ import co.elastic.apm.agent.bci.bytebuddy.NonInstrumented; import co.elastic.apm.agent.bci.bytebuddy.PatchBytecodeVersionTo51Transformer; import co.elastic.apm.agent.bci.bytebuddy.RootPackageCustomLocator; -import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory; import co.elastic.apm.agent.bci.classloading.ExternalPluginClassLoader; import co.elastic.apm.agent.bci.modules.ModuleOpener; import co.elastic.apm.agent.common.ThreadUtils; @@ -37,38 +34,48 @@ import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; -import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.logging.ApmServerLogAppender; import co.elastic.apm.agent.matcher.MethodMatcher; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; +import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory; +import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory; +import co.elastic.apm.agent.sdk.internal.PluginClassLoaderRootPackageCustomizer; +import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; import co.elastic.apm.agent.tracemethods.TraceMethodInstrumentation; +import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.util.DependencyInjectingServiceLoader; import co.elastic.apm.agent.util.ExecutorUtils; -import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import net.bytebuddy.ByteBuddy; import net.bytebuddy.agent.builder.AgentBuilder; import net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy; import net.bytebuddy.agent.builder.ResettableClassFileTransformer; import net.bytebuddy.asm.Advice; +import net.bytebuddy.asm.AsmVisitorWrapper; import net.bytebuddy.asm.TypeConstantAdjustment; import net.bytebuddy.description.NamedElement; import net.bytebuddy.description.annotation.AnnotationDescription; +import net.bytebuddy.description.field.FieldDescription; +import net.bytebuddy.description.field.FieldList; import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.description.method.MethodList; import net.bytebuddy.description.method.ParameterDescription; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; import net.bytebuddy.dynamic.DynamicType; import net.bytebuddy.dynamic.scaffold.TypeValidation; +import net.bytebuddy.implementation.Implementation; import net.bytebuddy.implementation.bytecode.StackManipulation; import net.bytebuddy.implementation.bytecode.member.MethodInvocation; import net.bytebuddy.matcher.ElementMatcher; import net.bytebuddy.matcher.ElementMatchers; import net.bytebuddy.pool.TypePool; import net.bytebuddy.utility.JavaModule; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.util.CheckClassAdapter; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.source.ConfigurationSource; @@ -440,6 +447,28 @@ public boolean matches(TypeDescription typeDescription, ClassLoader classLoader, }; return agentBuilder .type(instrumentationStats.shouldMeasureMatching() ? statsCollectingMatcher : matcher) + .transform(new AgentBuilder.Transformer() { + @Override + public DynamicType.Builder transform(DynamicType.Builder builder, TypeDescription typeDescription, + ClassLoader classLoader, JavaModule module, ProtectionDomain protectionDomain) { + return builder.visit(new AsmVisitorWrapper() { + @Override + public int mergeWriter(int flags) { + return flags; + } + + @Override + public int mergeReader(int flags) { + return flags; + } + + @Override + public ClassVisitor wrap(TypeDescription typeDescription, ClassVisitor classVisitor, Implementation.Context context, TypePool typePool, FieldList fieldList, MethodList methodList, int i, int i1) { + return new CheckClassAdapter(classVisitor); + } + }); + } + }) .transform(new PatchBytecodeVersionTo51Transformer()) .transform(getTransformer(instrumentation, logger, methodMatcher)) .transform(new AgentBuilder.Transformer() { From 055776153bde9c9e70b503936318b92add0d0611 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Mon, 26 May 2025 14:04:34 +0200 Subject: [PATCH 07/14] More logging --- .../java/co/elastic/apm/agent/bci/ElasticApmAgent.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java index b529d0b01b..70eab87d88 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java @@ -464,6 +464,7 @@ public int mergeReader(int flags) { @Override public ClassVisitor wrap(TypeDescription typeDescription, ClassVisitor classVisitor, Implementation.Context context, TypePool typePool, FieldList fieldList, MethodList methodList, int i, int i1) { + logger.debug("Checking verification for class {}", typeDescription.getName()); return new CheckClassAdapter(classVisitor); } }); @@ -737,6 +738,13 @@ private static AgentBuilder getAgentBuilder(final ByteBuddy byteBuddy, final Cor public Iterable>> onError(int index, List> batch, Throwable throwable, List> types) { logger.warn("Error while redefining classes {}", throwable.getMessage()); logger.debug(throwable.getMessage(), throwable); + if (logger.isDebugEnabled()) { + List names = new ArrayList<>(); + for (Class clazz : batch) { + names.add(clazz.getName()); + } + logger.debug("Failed batch of redefined classes: {}", batch); + } return super.onError(index, batch, throwable, types); } }) From 3d46f594f3985e550ee0ca105be711cbeb484160 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Mon, 26 May 2025 15:38:35 +0200 Subject: [PATCH 08/14] Revert changes tow working state --- apm-agent-core/pom.xml | 5 --- .../apm/agent/bci/ElasticApmAgent.java | 37 ------------------- pom.xml | 24 ++++++++++++ 3 files changed, 24 insertions(+), 42 deletions(-) diff --git a/apm-agent-core/pom.xml b/apm-agent-core/pom.xml index dca90c4e41..f2207fbd4c 100644 --- a/apm-agent-core/pom.xml +++ b/apm-agent-core/pom.xml @@ -89,11 +89,6 @@ asm-tree ${version.asm} - - org.ow2.asm - asm-util - ${version.asm} - org.hdrhistogram HdrHistogram diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java index 70eab87d88..baecf7801c 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java @@ -54,28 +54,21 @@ import net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy; import net.bytebuddy.agent.builder.ResettableClassFileTransformer; import net.bytebuddy.asm.Advice; -import net.bytebuddy.asm.AsmVisitorWrapper; import net.bytebuddy.asm.TypeConstantAdjustment; import net.bytebuddy.description.NamedElement; import net.bytebuddy.description.annotation.AnnotationDescription; -import net.bytebuddy.description.field.FieldDescription; -import net.bytebuddy.description.field.FieldList; import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.description.method.MethodList; import net.bytebuddy.description.method.ParameterDescription; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.ClassFileLocator; import net.bytebuddy.dynamic.DynamicType; import net.bytebuddy.dynamic.scaffold.TypeValidation; -import net.bytebuddy.implementation.Implementation; import net.bytebuddy.implementation.bytecode.StackManipulation; import net.bytebuddy.implementation.bytecode.member.MethodInvocation; import net.bytebuddy.matcher.ElementMatcher; import net.bytebuddy.matcher.ElementMatchers; import net.bytebuddy.pool.TypePool; import net.bytebuddy.utility.JavaModule; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.util.CheckClassAdapter; import org.stagemonitor.configuration.ConfigurationOption; import org.stagemonitor.configuration.source.ConfigurationSource; @@ -447,29 +440,6 @@ public boolean matches(TypeDescription typeDescription, ClassLoader classLoader, }; return agentBuilder .type(instrumentationStats.shouldMeasureMatching() ? statsCollectingMatcher : matcher) - .transform(new AgentBuilder.Transformer() { - @Override - public DynamicType.Builder transform(DynamicType.Builder builder, TypeDescription typeDescription, - ClassLoader classLoader, JavaModule module, ProtectionDomain protectionDomain) { - return builder.visit(new AsmVisitorWrapper() { - @Override - public int mergeWriter(int flags) { - return flags; - } - - @Override - public int mergeReader(int flags) { - return flags; - } - - @Override - public ClassVisitor wrap(TypeDescription typeDescription, ClassVisitor classVisitor, Implementation.Context context, TypePool typePool, FieldList fieldList, MethodList methodList, int i, int i1) { - logger.debug("Checking verification for class {}", typeDescription.getName()); - return new CheckClassAdapter(classVisitor); - } - }); - } - }) .transform(new PatchBytecodeVersionTo51Transformer()) .transform(getTransformer(instrumentation, logger, methodMatcher)) .transform(new AgentBuilder.Transformer() { @@ -738,13 +708,6 @@ private static AgentBuilder getAgentBuilder(final ByteBuddy byteBuddy, final Cor public Iterable>> onError(int index, List> batch, Throwable throwable, List> types) { logger.warn("Error while redefining classes {}", throwable.getMessage()); logger.debug(throwable.getMessage(), throwable); - if (logger.isDebugEnabled()) { - List names = new ArrayList<>(); - for (Class clazz : batch) { - names.add(clazz.getName()); - } - logger.debug("Failed batch of redefined classes: {}", batch); - } return super.onError(index, batch, throwable, types); } }) diff --git a/pom.xml b/pom.xml index 764bfe0960..7dd57edcf2 100644 --- a/pom.xml +++ b/pom.xml @@ -475,6 +475,30 @@ + + org.jacoco + jacoco-maven-plugin + + + **/*.esclazz + **/*.jar + + + + + + prepare-agent + + + + report + test + + report + + + + com.mycila From 68508558a9adebe49ead421876bf3a3d2a858970 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Mon, 26 May 2025 17:16:28 +0200 Subject: [PATCH 09/14] Upgrade junit, disable profiling tests on java 24+ --- .../apm/agent/profiler/CallTreeSpanifyTest.java | 3 +++ .../co/elastic/apm/agent/profiler/CallTreeTest.java | 10 ++++++++-- .../apm/agent/profiler/SamplingProfilerQueueTest.java | 3 +++ .../apm/agent/profiler/SamplingProfilerTest.java | 1 + pom.xml | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java index 6fe80f177d..a2ddc43b38 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeSpanifyTest.java @@ -30,7 +30,9 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledForJreRange; import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.condition.OS; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -67,6 +69,7 @@ void tearDown() throws IOException { @Test @DisabledOnOs(OS.WINDOWS) @DisabledOnAppleSilicon + @DisabledForJreRange(min = JRE.JAVA_24) void testSpanification() throws Exception { CallTree.Root callTree = CallTreeTest.getCallTree(tracer, new String[]{ " dd ", diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java index 99040fba40..c67e3f553d 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/CallTreeTest.java @@ -21,20 +21,25 @@ import co.elastic.apm.agent.MockReporter; import co.elastic.apm.agent.MockTracer; import co.elastic.apm.agent.configuration.SpyConfiguration; -import co.elastic.apm.agent.impl.transaction.*; -import co.elastic.apm.agent.tracer.configuration.TimeDuration; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.sampling.ConstantSampler; +import co.elastic.apm.agent.impl.transaction.AbstractSpanImpl; import co.elastic.apm.agent.impl.transaction.SpanImpl; +import co.elastic.apm.agent.impl.transaction.StackFrame; +import co.elastic.apm.agent.impl.transaction.TraceContextImpl; +import co.elastic.apm.agent.impl.transaction.TransactionImpl; import co.elastic.apm.agent.objectpool.NoopObjectPool; import co.elastic.apm.agent.objectpool.ObservableObjectPool; import co.elastic.apm.agent.objectpool.impl.ListBasedObjectPool; import co.elastic.apm.agent.testutils.DisabledOnAppleSilicon; +import co.elastic.apm.agent.tracer.configuration.TimeDuration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledForJreRange; import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.condition.OS; import org.stagemonitor.configuration.ConfigurationRegistry; @@ -57,6 +62,7 @@ @DisabledOnOs(OS.WINDOWS) @DisabledOnAppleSilicon +@DisabledForJreRange(min = JRE.JAVA_24) class CallTreeTest { private MockReporter reporter; diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerQueueTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerQueueTest.java index 1a68e2d2a0..2c27e12e6e 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerQueueTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerQueueTest.java @@ -24,7 +24,9 @@ import co.elastic.apm.agent.objectpool.ObjectPoolFactoryImpl; import co.elastic.apm.agent.testutils.DisabledOnAppleSilicon; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledForJreRange; import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.condition.OS; import static org.assertj.core.api.Assertions.assertThat; @@ -35,6 +37,7 @@ public class SamplingProfilerQueueTest { @Test @DisabledOnOs(OS.WINDOWS) @DisabledOnAppleSilicon + @DisabledForJreRange(min = JRE.JAVA_24) void testFillQueue() throws Exception { System.out.println(System.getProperty("os.name")); diff --git a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerTest.java b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerTest.java index de7e720185..fd2de1c555 100644 --- a/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerTest.java +++ b/apm-agent-plugins/apm-profiling-plugin/src/test/java/co/elastic/apm/agent/profiler/SamplingProfilerTest.java @@ -56,6 +56,7 @@ // async-profiler doesn't work on Windows @DisabledOnOs(OS.WINDOWS) @DisabledOnAppleSilicon +@DisabledForJreRange(min = JRE.JAVA_24) class SamplingProfilerTest { private MockReporter reporter; diff --git a/pom.xml b/pom.xml index 7dd57edcf2..5ff9d4a2a1 100644 --- a/pom.xml +++ b/pom.xml @@ -116,7 +116,7 @@ 2.2.0 1.4.196 - 5.9.1 + 5.12.2 4.13.2 4.12.0 From 2d35fd930dd3017e769d8fef7a2c5cf3177aca74 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Tue, 27 May 2025 10:17:10 +0200 Subject: [PATCH 10/14] Fix lambda tests after JUnit upgrade --- .../java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java index 7ba58a8206..c85302e72e 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/test/java/co/elastic/apm/agent/awslambda/AbstractLambdaTest.java @@ -149,7 +149,9 @@ protected boolean supportsContextPropagation() { return true; } + static synchronized void initAllButInstrumentation() { + ElasticApmAgent.reset(); // reset the AbstractInstrumentationTest beforeAll initialization config = SpyConfiguration.createSpyConfig(); serverlessConfiguration = config.getConfig(ServerlessConfigurationImpl.class); doReturn(true).when(serverlessConfiguration).runsOnAwsLambda(); From 843098ce45e86ff50f238704735d2a4cbaa36a3c Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Tue, 27 May 2025 12:48:42 +0200 Subject: [PATCH 11/14] Update jacoco, add comments and docs --- docs/reference/config-profiling.md | 1 + pom.xml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/docs/reference/config-profiling.md b/docs/reference/config-profiling.md index 2ce94f80ed..9de008babf 100644 --- a/docs/reference/config-profiling.md +++ b/docs/reference/config-profiling.md @@ -51,6 +51,7 @@ The extension needs to bind a socket to a file for communicating with the univer ::::{note} This feature is currently experimental, which means it is disabled by default and it is not guaranteed to be backwards compatible in future releases. +It is currently only supported on Java 7 to Java 23, newer versions are unsupported. :::: diff --git a/pom.xml b/pom.xml index 5ff9d4a2a1..5349627dcc 100644 --- a/pom.xml +++ b/pom.xml @@ -476,6 +476,19 @@ + org.jacoco jacoco-maven-plugin @@ -593,6 +606,11 @@ maven-enforcer-plugin 3.0.0-M1 + + org.jacoco + jacoco-maven-plugin + 0.8.13 + org.codehaus.mojo license-maven-plugin From 001531a58bf464cd0acede350aecc7dcc0bcb2d9 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Tue, 27 May 2025 12:49:34 +0200 Subject: [PATCH 12/14] Revert unnecessary changes --- .../java/co/elastic/apm/agent/bci/ElasticApmAgent.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java index baecf7801c..9f60cf3363 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java @@ -18,6 +18,8 @@ */ package co.elastic.apm.agent.bci; +import co.elastic.apm.agent.sdk.internal.PluginClassLoaderRootPackageCustomizer; +import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory; import co.elastic.apm.agent.bci.bytebuddy.ErrorLoggingListener; import co.elastic.apm.agent.bci.bytebuddy.FailSafeDeclaredMethodsCompiler; import co.elastic.apm.agent.bci.bytebuddy.InstallationListenerImpl; @@ -27,6 +29,7 @@ import co.elastic.apm.agent.bci.bytebuddy.NonInstrumented; import co.elastic.apm.agent.bci.bytebuddy.PatchBytecodeVersionTo51Transformer; import co.elastic.apm.agent.bci.bytebuddy.RootPackageCustomLocator; +import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory; import co.elastic.apm.agent.bci.classloading.ExternalPluginClassLoader; import co.elastic.apm.agent.bci.modules.ModuleOpener; import co.elastic.apm.agent.common.ThreadUtils; @@ -34,21 +37,18 @@ import co.elastic.apm.agent.configuration.CoreConfigurationImpl; import co.elastic.apm.agent.impl.ElasticApmTracer; import co.elastic.apm.agent.impl.ElasticApmTracerBuilder; +import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.logging.ApmServerLogAppender; import co.elastic.apm.agent.matcher.MethodMatcher; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; -import co.elastic.apm.agent.sdk.bytebuddy.AnnotationValueOffsetMappingFactory; -import co.elastic.apm.agent.sdk.bytebuddy.SimpleMethodSignatureOffsetMappingFactory; -import co.elastic.apm.agent.sdk.internal.PluginClassLoaderRootPackageCustomizer; -import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import co.elastic.apm.agent.sdk.logging.Logger; import co.elastic.apm.agent.sdk.logging.LoggerFactory; import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent; import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap; import co.elastic.apm.agent.tracemethods.TraceMethodInstrumentation; -import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.util.DependencyInjectingServiceLoader; import co.elastic.apm.agent.util.ExecutorUtils; +import co.elastic.apm.agent.sdk.internal.util.PrivilegedActionUtils; import net.bytebuddy.ByteBuddy; import net.bytebuddy.agent.builder.AgentBuilder; import net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy; From 3165f599684af0c3d963fc3225131ce47d69fa96 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Tue, 27 May 2025 13:37:56 +0200 Subject: [PATCH 13/14] Move clarification away from experimental note --- docs/reference/config-profiling.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/reference/config-profiling.md b/docs/reference/config-profiling.md index 9de008babf..0dbeca1aaa 100644 --- a/docs/reference/config-profiling.md +++ b/docs/reference/config-profiling.md @@ -51,7 +51,6 @@ The extension needs to bind a socket to a file for communicating with the univer ::::{note} This feature is currently experimental, which means it is disabled by default and it is not guaranteed to be backwards compatible in future releases. -It is currently only supported on Java 7 to Java 23, newer versions are unsupported. :::: @@ -64,7 +63,7 @@ The inferred spans are created after a profiling session has ended. This means t Only platform threads are supported. Virtual threads are not supported and will not be profiled. ::::{note} -This feature is not available on Windows and on OpenJ9 +This feature is not available on Windows and on OpenJ9. In addition only Java 7 to Java 23 are supported. :::: From 39cf1115b695947b25784749b279b21664b2ca17 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Tue, 27 May 2025 14:55:16 +0200 Subject: [PATCH 14/14] Add module opens to spring 1.5, must be a side effect of JUnit upgrade --- integration-tests/spring-boot-1-5/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/integration-tests/spring-boot-1-5/pom.xml b/integration-tests/spring-boot-1-5/pom.xml index 65da27408b..a04f68b12c 100644 --- a/integration-tests/spring-boot-1-5/pom.xml +++ b/integration-tests/spring-boot-1-5/pom.xml @@ -76,4 +76,16 @@ + + + + org.apache.maven.plugins + maven-failsafe-plugin + + --add-opens java.base/java.lang=ALL-UNNAMED + + + + +