Skip to content

Commit 0e5e274

Browse files
authored
Capture the auto-injection related settings in JFR recording (#7317)
1 parent f0eec59 commit 0e5e274

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

dd-java-agent/agent-profiling/profiling-controller-ddprof/src/main/java/com/datadog/profiling/controller/ddprof/DatadogProfilerSettings.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,11 @@ public void publish() {
2929
datadogProfiler.recordSetting(JFR_IMPLEMENTATION_KEY, "ddprof");
3030
datadogProfiler.recordSetting(STACK_DEPTH_KEY, String.valueOf(stackDepth));
3131
datadogProfiler.recordSetting(SELINUX_STATUS_KEY, seLinuxStatus);
32+
if (serviceInstrumentationType != null) {
33+
datadogProfiler.recordSetting(SERVICE_INSTRUMENTATION_TYPE, serviceInstrumentationType);
34+
}
35+
if (serviceInjection != null) {
36+
datadogProfiler.recordSetting(SERVICE_INJECTION, serviceInjection);
37+
}
3238
}
3339
}

dd-java-agent/agent-profiling/profiling-controller-openjdk/src/main/java/com/datadog/profiling/controller/openjdk/JfrProfilerSettings.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public void publish() {
6262
if (ddprofUnavailableReason != null) {
6363
new ProfilerSettingEvent(DDPROF_UNAVAILABLE_REASON_KEY, ddprofUnavailableReason).commit();
6464
}
65+
if (serviceInstrumentationType != null) {
66+
new ProfilerSettingEvent(SERVICE_INSTRUMENTATION_TYPE, serviceInstrumentationType).commit();
67+
}
68+
if (serviceInjection != null) {
69+
new ProfilerSettingEvent(SERVICE_INJECTION, serviceInjection).commit();
70+
}
6571
}
6672
}
6773
}

dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller/ProfilerSettingsSupport.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public abstract class ProfilerSettingsSupport {
3131
protected static final String NATIVE_STACKS_KEY = "Native Stacks";
3232
protected static final String STACK_DEPTH_KEY = "Stack Depth";
3333
protected static final String SELINUX_STATUS_KEY = "SELinux Status";
34+
protected static final String SERVICE_INSTRUMENTATION_TYPE = "Service Instrumentation Type";
35+
protected static final String SERVICE_INJECTION = "Service Injection";
3436

3537
protected static final String DDPROF_UNAVAILABLE_REASON_KEY = "DDProf Unavailable Reason";
3638

@@ -50,6 +52,8 @@ public abstract class ProfilerSettingsSupport {
5052
protected final String perfEventsParanoid;
5153
protected final boolean hasNativeStacks;
5254
protected final String seLinuxStatus;
55+
protected final String serviceInstrumentationType;
56+
protected final String serviceInjection;
5357

5458
protected final String ddprofUnavailableReason;
5559

@@ -122,6 +126,13 @@ protected ProfilerSettingsSupport(
122126
seLinuxStatus = getSELinuxStatus();
123127
this.ddprofUnavailableReason = ddprofUnavailableReason;
124128
this.hasJfrStackDepthApplied = hasJfrStackDepthApplied;
129+
130+
serviceInjection =
131+
configProvider.getString(
132+
"injection.enabled"); // usually set via DD_INJECTION_ENABLED env var
133+
serviceInstrumentationType =
134+
// usually set via DD_INSTRUMENTATION_INSTALL_TYPE env var
135+
configProvider.getString("instrumentation.install.type");
125136
}
126137

127138
private String getSELinuxStatus() {

0 commit comments

Comments
 (0)