apupier opened a new pull request, #30341: URL: https://github.com/apache/camel/pull/30341
CAMEL-27163: Only instrument `org.apache.camel` classes with the JaCoCo agent in the coverage profile ## Problem On Jenkins, the coverage profile (`-Pcoverage`) moves the build and test time of the ubuntu-avx jdk 21 build from about 34 min to about 55 min. The test JVMs also use noticeably more memory. The `prepare-agent` execution of the `coverage` profile in `parent/pom.xml` had no `includes`, so the JaCoCo agent instrumented every class loaded by the forked test JVMs: Camel classes, but also all the third party libraries and the test dependencies. This costs CPU and memory in every forked test JVM and brings nothing: the coverage reported to Sonar (`coverage/target/site/jacoco-aggregate/jacoco.xml`) is only about the Camel main sources. ## Change Add `<includes><include>org/apache/camel/**</include></includes>` to the agent configuration of the `coverage` profile in `parent/pom.xml`. The existing `CamelThreadFactory*` exclusion (workaround of jacoco/jacoco#407) is kept. All the main sources of the repository are in the `org.apache.camel` package. The only other package is `com.acme`, a file in the test resources of `camel-jbang-core` used as an example, which does not need coverage. The generated agent argument is now: ``` -javaagent:...org.jacoco.agent-0.8.15-runtime.jar=destfile=.../target/jacoco.exec,includes=org/apache/camel/**,excludes=**/CamelThreadFactory* ``` ## Measurements Both runs were done on the same machine (22 cores, 30 GB), with the exact command of the `Jenkinsfile` for the ubuntu-avx jdk 21 build (`./mvnw -T1C -B -e -fae -V -Dnoassembly -Dsurefire.rerunFailingTestsCount=2 -Dfailsafe.rerunFailingTestsCount=1 -Dci.env.name=apache.org -Darchetype.test.skip -Dmaven.test.failure.ignore=true -Dcheckstyle.skip=true install -Dcamel.threads.virtual.enabled=false -Pcoverage`), once with the change and once without. The build without the change was stopped by an out of memory at module 646 of 729, so the comparison is on the part of the build that completed in both runs. The build with the change completed (`BUILD SUCCESS`, 37 min). | Measure | Without the change | With the change | Ratio | |---|---|---|---| | Sum of the test time of the 11,866 test classes run in both builds | 49,685 s | 41,942 s | 0.84 | | Sum for the 237 modules with more than 30 s of test time | 46,661 s | 39,562 s | 0.85 | | Median per module ratio | | | 0.85 | | Size of `jacoco.exec` for `camel-netty` | 241 KB | 94 KB | 0.39 | Individual modules are noisy (the machine was loaded and swapping at times, some modules are slower, others faster), the totals are what is meaningful. The real effect on the Jenkins node will be visible on the next build of `main`. ## Notes - The coverage report generation (`report-aggregate`) is unchanged. - No test change: this only changes the configuration of the `coverage` profile, which is not active by default. --- _This PR description is AI-generated by IBM Bob 2.2.1 on behalf of @apupier._ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
