Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ba4b80b
Test with jdk 24 ea
JonasKunz Jan 22, 2025
af21dee
Merge remote-tracking branch 'elastic/main' into test-java24
JonasKunz Mar 5, 2025
90d99cb
Merge branch 'main' of github.com:elastic/apm-agent-java into test-ja…
SylvainJuge Apr 1, 2025
07efdb3
test with java 24 GA and remove 23
SylvainJuge Apr 1, 2025
5fd986a
update test as 24 has been released
SylvainJuge Apr 1, 2025
71c802a
add java 25 early access as well
SylvainJuge Apr 1, 2025
14faaca
try to remove jacoco
SylvainJuge Apr 2, 2025
1de0e89
Merge branch 'main' of github.com:elastic/apm-agent-java into test-ja…
SylvainJuge Apr 9, 2025
34db676
Merge branch 'main' of github.com:elastic/apm-agent-java into test-ja…
SylvainJuge May 5, 2025
1b6259c
Merge branch 'main' of github.com:elastic/apm-agent-java into test-ja…
SylvainJuge May 5, 2025
033be97
Merge remote-tracking branch 'elastic/main' into test-java24
JonasKunz May 26, 2025
f9e2343
Add CheckClassAdapter to analyze bytecode verification erros
JonasKunz May 26, 2025
0557761
More logging
JonasKunz May 26, 2025
3d46f59
Revert changes tow working state
JonasKunz May 26, 2025
6850855
Upgrade junit, disable profiling tests on java 24+
JonasKunz May 26, 2025
2d35fd9
Fix lambda tests after JUnit upgrade
JonasKunz May 27, 2025
843098c
Update jacoco, add comments and docs
JonasKunz May 27, 2025
001531a
Revert unnecessary changes
JonasKunz May 27, 2025
3165f59
Move clarification away from experimental note
JonasKunz May 27, 2025
39cf111
Add module opens to spring 1.5, must be a side effect of JUnit upgrade
JonasKunz May 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ jobs:
distribution: 'temurin'
- version: 21
distribution: 'temurin'
- version: 23
- version: 24
distribution: 'temurin'
- version: '25-ea'
distribution: 'temurin'
steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class JdkVersionTest {
private static List<Arguments> 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"))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ protected boolean supportsContextPropagation() {
return true;
}


static synchronized void initAllButInstrumentation() {
ElasticApmAgent.reset(); // reset the AbstractInstrumentationTest beforeAll initialization

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JUnit upgrade made the lambda tests fail.
They apparently have been relieing on a bug where static @BeforeAll methods from subclasses would replace static @BeforeAll in parent methods. Now they both execute, causing the tracer to be initialized twice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's lol

config = SpyConfiguration.createSpyConfig();
serverlessConfiguration = config.getConfig(ServerlessConfigurationImpl.class);
doReturn(true).when(serverlessConfiguration).runsOnAwsLambda();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -57,6 +62,7 @@

@DisabledOnOs(OS.WINDOWS)
@DisabledOnAppleSilicon
@DisabledForJreRange(min = JRE.JAVA_24)
class CallTreeTest {

private MockReporter reporter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/config-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,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.
::::


Expand Down
12 changes: 12 additions & 0 deletions integration-tests/spring-boot-1-5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,16 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</build>

</project>
17 changes: 15 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<!-- -dependencies versions -->
<version.error_prone>2.2.0</version.error_prone>
<version.h2>1.4.196</version.h2>
<version.junit>5.9.1</version.junit>
<version.junit>5.12.2</version.junit>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JUnit had to be updated to include the newer java versions in @DisabledForJRE

<version.junit.vintage>4.13.2</version.junit.vintage>
<version.okhttp>4.12.0</version.okhttp>
<!-- this is the last version of slf4j that is compatible with Java 7-->
Expand Down Expand Up @@ -476,6 +476,19 @@
</executions>
</plugin>
<plugin>
<!--
Note that we don't actively use jacoco anymore, but for reasons beyond my understanding the tests will fail if we remove it.
When removing jacoco, some tests will fail deterministically with a java.lang.VerifyError: null during retransformation
of the classes under test. I extracted the bytecode from the failed tests and verified it manually using the ASM CheckClassAdapter,
there the bytecode looks fine and is validated without issues.
My best guess of an explanation for this behaviour is that we cause some kind of obscure JVM bug during our tests, because
we continuously retransform classes. This "bug" seems to be prevented by having multiple agents in the JVM (e.g. running the tests
from IntelliJ with IntelliJ's debug agent also makes them succeed.
This seems to happen only due to the runtime attachment of the agent in the tests,
because we have never seen these kinds of problems in production systems.

So for now I've decided to just let it be and leave jacoco in here.
-->
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
Expand Down Expand Up @@ -596,7 +609,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.13</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down