4040import datadog .trace .api .profiling .ProfilingEnablement ;
4141import datadog .trace .api .scopemanager .ScopeListener ;
4242import datadog .trace .bootstrap .benchmark .StaticEventLogger ;
43- import datadog .trace .bootstrap .config .provider .ConfigProvider ;
4443import datadog .trace .bootstrap .config .provider .StableConfigSource ;
4544import datadog .trace .bootstrap .instrumentation .api .AgentTracer ;
4645import datadog .trace .bootstrap .instrumentation .api .AgentTracer .TracerAPI ;
@@ -1052,10 +1051,15 @@ private static void initializeCrashTrackingDefault() {
10521051 }
10531052
10541053 private static boolean isCrashTrackingAutoconfigEnabled () {
1055- return !ConfigProvider .getInstance ()
1056- .getBoolean (
1057- CrashTrackingConfig .CRASH_TRACKING_DISABLE_AUTOCONFIG ,
1058- CrashTrackingConfig .CRASH_TRACKING_DISABLE_AUTOCONFIG_DEFAULT );
1054+ String enabledVal = ddGetProperty ("dd." + CrashTrackingConfig .CRASH_TRACKING_ENABLE_AUTOCONFIG );
1055+ boolean enabled = CrashTrackingConfig .CRASH_TRACKING_ENABLE_AUTOCONFIG_DEFAULT ;
1056+ if (enabledVal != null ) {
1057+ enabled = Boolean .parseBoolean (enabledVal );
1058+ } else {
1059+ // If the property is not set, then we check if profiling is enabled
1060+ enabled = profilingEnabled ;
1061+ }
1062+ return enabled ;
10591063 }
10601064
10611065 private static void initializeCrashTracking (boolean delayed , boolean checkNative ) {
@@ -1067,7 +1071,7 @@ private static void initializeCrashTracking(boolean delayed, boolean checkNative
10671071 try {
10681072 Class <?> clz = AGENT_CLASSLOADER .loadClass ("datadog.crashtracking.Initializer" );
10691073 // first try to use the JVMAccess using the native library; unless `checkNative` is false
1070- boolean rslt =
1074+ Boolean rslt =
10711075 checkNative && (boolean ) clz .getMethod ("initialize" , boolean .class ).invoke (null , false );
10721076 if (!rslt ) {
10731077 if (delayed ) {
@@ -1078,9 +1082,12 @@ private static void initializeCrashTracking(boolean delayed, boolean checkNative
10781082 // delayed initialization, so we need to reschedule it and mark as delayed but do not
10791083 // re-check the native library
10801084 CRASHTRACKER_INIT_AFTER_JMX = Agent ::initializeDelayedCrashTrackingOnlyJmx ;
1085+ rslt = null ; // we will initialize it later
10811086 }
10821087 }
1083- if (rslt ) {
1088+ if (rslt == null ) {
1089+ log .debug ("Crashtracking initialization delayed until JMX is available" );
1090+ } else if (rslt ) {
10841091 log .debug ("Crashtracking initialized" );
10851092 } else {
10861093 log .debug (
0 commit comments