Merge pull request #621 from DataDog/mar-kolya/fix-wildfly-startup
Fix wildfly startup by injecting context classes into bootstrap package
This commit is contained in:
commit
2d28b5129e
|
@ -70,6 +70,14 @@ import net.bytebuddy.utility.JavaModule;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FieldBackedProvider implements InstrumentationContextProvider {
|
public class FieldBackedProvider implements InstrumentationContextProvider {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Note: the value here has to be inside on of the prefixes in
|
||||||
|
datadog.trace.agent.tooling.Utils#BOOTSTRAP_PACKAGE_PREFIXES. This ensures that 'isolating' (or 'module')
|
||||||
|
classloaders like jboss and osgi see injected classes. This works because we instrument those classloaders
|
||||||
|
to load everything inside bootstrap packages.
|
||||||
|
*/
|
||||||
|
private static final String DYNAMIC_CLASSES_PACKAGE =
|
||||||
|
"datadog.trace.bootstrap.instrumentation.context.";
|
||||||
private static final String INJECTED_FIELDS_MARKER_CLASS_NAME =
|
private static final String INJECTED_FIELDS_MARKER_CLASS_NAME =
|
||||||
Utils.getInternalName(FieldBackedContextStoreAppliedMarker.class.getName());
|
Utils.getInternalName(FieldBackedContextStoreAppliedMarker.class.getName());
|
||||||
|
|
||||||
|
@ -903,7 +911,8 @@ public class FieldBackedProvider implements InstrumentationContextProvider {
|
||||||
|
|
||||||
private String getContextStoreImplementationClassName(
|
private String getContextStoreImplementationClassName(
|
||||||
final String keyClassName, final String contextClassName) {
|
final String keyClassName, final String contextClassName) {
|
||||||
return getClass().getName()
|
return DYNAMIC_CLASSES_PACKAGE
|
||||||
|
+ getClass().getSimpleName()
|
||||||
+ "$ContextStore$"
|
+ "$ContextStore$"
|
||||||
+ Utils.converToInnerClassName(keyClassName)
|
+ Utils.converToInnerClassName(keyClassName)
|
||||||
+ "$"
|
+ "$"
|
||||||
|
@ -912,7 +921,8 @@ public class FieldBackedProvider implements InstrumentationContextProvider {
|
||||||
|
|
||||||
private String getContextAccessorInterfaceName(
|
private String getContextAccessorInterfaceName(
|
||||||
final String keyClassName, final String contextClassName) {
|
final String keyClassName, final String contextClassName) {
|
||||||
return getClass().getName()
|
return DYNAMIC_CLASSES_PACKAGE
|
||||||
|
+ getClass().getSimpleName()
|
||||||
+ "$ContextAccessor$"
|
+ "$ContextAccessor$"
|
||||||
+ Utils.converToInnerClassName(keyClassName)
|
+ Utils.converToInnerClassName(keyClassName)
|
||||||
+ "$"
|
+ "$"
|
||||||
|
|
|
@ -52,7 +52,7 @@ class FieldBackedProviderTest extends AgentTestRunner {
|
||||||
if (inter.getName() == 'datadog.trace.bootstrap.FieldBackedContextStoreAppliedMarker') {
|
if (inter.getName() == 'datadog.trace.bootstrap.FieldBackedContextStoreAppliedMarker') {
|
||||||
hasMarkerInterface = true
|
hasMarkerInterface = true
|
||||||
}
|
}
|
||||||
if (inter.getName().startsWith('datadog.trace.agent.tooling.context.FieldBackedProvider$ContextAccessor')) {
|
if (inter.getName().startsWith('datadog.trace.bootstrap.instrumentation.context.FieldBackedProvider$ContextAccessor')) {
|
||||||
hasAccessorInterface = true
|
hasAccessorInterface = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ class FieldBackedProviderFieldInjectionDisabledTest extends AgentTestRunner {
|
||||||
if (inter.getName() == 'datadog.trace.bootstrap.FieldBackedContextStoreAppliedMarker') {
|
if (inter.getName() == 'datadog.trace.bootstrap.FieldBackedContextStoreAppliedMarker') {
|
||||||
hasMarkerInterface = true
|
hasMarkerInterface = true
|
||||||
}
|
}
|
||||||
if (inter.getName().startsWith('datadog.trace.agent.tooling.context.FieldBackedProvider$ContextAccessor')) {
|
if (inter.getName().startsWith('datadog.trace.bootstrap.instrumentation.context.FieldBackedProvider$ContextAccessor')) {
|
||||||
hasAccessorInterface = true
|
hasAccessorInterface = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue