Skip to content

Commit

Permalink
Universal bootdelegation (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixbarny authored Jul 1, 2020
1 parent b086026 commit e6737ac
Show file tree
Hide file tree
Showing 21 changed files with 150 additions and 482 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ endif::[]
[float]
===== Features
* Experimental support for runtime attachment now also for OSGi containers, JBoss, and WildFly
* New mitigation of OSGi bootdelegation errors (`NoClassDefFoundError`).
You can remove any `org.osgi.framework.bootdelegation` related configuration.
This release also removes the configuration option `boot_delegation_packages`.
* Overhaul of the `ExecutorService` instrumentation that avoids issues like ``ClassCastException``s - {pull}1206[#1206]
* Support for `ForJoinPool` and `ScheduledExecutorService` (see <<supported-async-frameworks>>)
* Support for `ExecutorService#invokeAny` and `ExecutorService#invokeAll`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
* This class is loaded by the system classloader,
* and adds the rest of the agent to the bootstrap class loader search.
* <p>
* This is required to instrument Java core classes like {@link Runnable} and to enable boot delegation in OSGi environments.
* See {@link OsgiBootDelegationEnabler}.
* This is required to instrument Java core classes like {@link Runnable}.
* </p>
* <p>
* Note that this relies on the fact that the system classloader is a parent-first classloader and first asks the bootstrap classloader
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -482,34 +482,6 @@ public class CoreConfiguration extends ConfigurationOptionProvider {
"the higher of both thresholds will determine which spans will be discarded.")
.buildWithDefault(TimeDuration.of("0ms"));

private final ConfigurationOption<String> appendPackagesToBootDelegationProperty = ConfigurationOption.stringOption()
.key("boot_delegation_packages")
.tags("added[1.7.0]")
.configurationCategory(CORE_CATEGORY)
.description("A comma-separated list of packages to be appended to the boot delegation system property. \n" +
"If set with an empty string, nothing will be appended to the boot delegation system property.\n" +
"Values to set in known environments:\n\n" +
"Nexus:\n\n" +
"----\n" +
"boot_delegation_packages=com.sun.*, javax.transaction, javax.transaction.*, javax.xml.crypto, javax.xml.crypto.*, sun.*," +
"co.elastic.apm.agent.*\n" +
"----\n\n" +
"Pentaho and RedHat JBoss Fuse:\n\n" +
"----\n" +
"boot_delegation_packages=org.apache.karaf.jaas.boot, org.apache.karaf.jaas.boot.principal, org.apache.karaf.management.boot, " +
"sun.*, com.sun.*, javax.transaction, javax.transaction.*, javax.xml.crypto, javax.xml.crypto.*, org.apache.xerces.jaxp.datatype, " +
"org.apache.xerces.stax, org.apache.xerces.parsers, org.apache.xerces.jaxp, org.apache.xerces.jaxp.validation, " +
"org.apache.xerces.dom, co.elastic.apm.agent.*\n" +
"----\n")
.buildWithDefault("co.elastic.apm.agent.*");

private final ConfigurationOption<Boolean> atlassianNewBootDelegation = ConfigurationOption.booleanOption()
.key("use_atlassian_new_boot_delegation")
.configurationCategory(CORE_CATEGORY)
.tags("internal")
.description("In new Atlassian OSGi there is a config to append to boot delegation packages instead of overriding the default.")
.buildWithDefault(false);

private final ConfigurationOption<Boolean> centralConfig = ConfigurationOption.booleanOption()
.key("central_config")
.tags("added[1.8.0]")
Expand Down Expand Up @@ -690,21 +662,6 @@ public TimeDuration getTraceMethodsDurationThreshold() {
return traceMethodsDurationThreshold.get();
}

public @Nullable String getPackagesToAppendToBootdelegationProperty() {
String value = appendPackagesToBootDelegationProperty.get();
if (value != null) {
value = value.trim();
if (value.isEmpty()) {
value = null;
}
}
return value;
}

public boolean useAtlassianNewBootDelegationConfig() {
return atlassianNewBootDelegation.get();
}

public Map<String, String> getGlobalLabels() {
return globalLabels.get();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
co.elastic.apm.agent.configuration.StartupInfo
co.elastic.apm.agent.bci.OsgiBootDelegationEnabler
co.elastic.apm.agent.bci.MatcherTimerLifecycleListener
co.elastic.apm.agent.metrics.builtin.JvmMemoryMetrics
co.elastic.apm.agent.metrics.builtin.SystemMetrics
Expand Down

This file was deleted.

19 changes: 19 additions & 0 deletions apm-agent-plugins/apm-bootdelegation-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apm-agent-plugins</artifactId>
<groupId>co.elastic.apm</groupId>
<version>1.17.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>apm-bootdelegation-plugin</artifactId>
<name>${project.groupId}:${project.artifactId}</name>

<properties>
<apm-agent-parent.base.dir>${project.basedir}/../..</apm-agent-parent.base.dir>
</properties>

</project>
Loading

0 comments on commit e6737ac

Please sign in to comment.