Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e200ff1

Browse files
Record the JFR implementation in settings (DataDog#6348)
1 parent e26f1a4 commit e200ff1

File tree

3 files changed

+63
-29
lines changed

3 files changed

+63
-29
lines changed

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,30 @@
22

33
import com.datadog.profiling.controller.ProfilerSettingsSupport;
44
import com.datadog.profiling.ddprof.DatadogProfiler;
5+
import datadog.trace.bootstrap.config.provider.ConfigProvider;
56

67
public class DatadogProfilerSettings extends ProfilerSettingsSupport {
78

89
private final DatadogProfiler datadogProfiler;
910

1011
public DatadogProfilerSettings(DatadogProfiler datadogProfiler) {
12+
super(ConfigProvider.getInstance());
1113
this.datadogProfiler = datadogProfiler;
1214
}
1315

1416
public void publish() {
15-
datadogProfiler.recordSetting("Upload Period", String.valueOf(uploadPeriod), "seconds");
16-
datadogProfiler.recordSetting("Upload Timeout", String.valueOf(uploadTimeout), "seconds");
17-
datadogProfiler.recordSetting("Upload Compression", uploadCompression);
17+
datadogProfiler.recordSetting(UPLOAD_PERIOD_KEY, String.valueOf(uploadPeriod), "seconds");
18+
datadogProfiler.recordSetting(UPLOAD_TIMEOUT_KEY, String.valueOf(uploadTimeout), "seconds");
19+
datadogProfiler.recordSetting(UPLOAD_COMPRESSION_KEY, uploadCompression);
1820
datadogProfiler.recordSetting(
19-
"Allocation Profiling", String.valueOf(allocationProfilingEnabled));
20-
datadogProfiler.recordSetting("Heap Profiling", String.valueOf(heapProfilingEnabled));
21-
datadogProfiler.recordSetting("Force Start-First", String.valueOf(startForceFirst));
22-
datadogProfiler.recordSetting("Hotspots", String.valueOf(hotspotsEnabled));
23-
datadogProfiler.recordSetting("Endpoints", String.valueOf(endpointsEnabled));
24-
datadogProfiler.recordSetting("Auxiliary Profiler", auxiliaryProfiler);
25-
datadogProfiler.recordSetting("perf_events_paranoid", perfEventsParanoid);
26-
datadogProfiler.recordSetting("Native Stacks", String.valueOf(hasNativeStacks));
21+
ALLOCATION_PROFILING_KEY, String.valueOf(allocationProfilingEnabled));
22+
datadogProfiler.recordSetting(HEAP_PROFILING_KEY, String.valueOf(heapProfilingEnabled));
23+
datadogProfiler.recordSetting(FORCE_START_FIRST_KEY, String.valueOf(startForceFirst));
24+
datadogProfiler.recordSetting(HOTSPOTS_KEY, String.valueOf(hotspotsEnabled));
25+
datadogProfiler.recordSetting(ENDPOINTS_KEY, String.valueOf(endpointsEnabled));
26+
datadogProfiler.recordSetting(AUXILIARY_PROFILER_KEY, auxiliaryProfiler);
27+
datadogProfiler.recordSetting(PERF_EVENTS_PARANOID_KEY, perfEventsParanoid);
28+
datadogProfiler.recordSetting(NATIVE_STACKS_KEY, String.valueOf(hasNativeStacks));
29+
datadogProfiler.recordSetting(JFR_IMPLEMENTATION_KEY, "ddprof");
2730
}
2831
}

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

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,56 @@
22

33
import com.datadog.profiling.controller.ProfilerSettingsSupport;
44
import com.datadog.profiling.controller.openjdk.events.ProfilerSettingEvent;
5+
import datadog.trace.api.Platform;
6+
import datadog.trace.bootstrap.config.provider.ConfigProvider;
57

68
/** Capture the profiler config first and allow emitting the setting events per each recording. */
79
final class JfrProfilerSettings extends ProfilerSettingsSupport {
10+
private static final String JFP_TEMPLATE_OVERRIDE_PROFILING_KEY =
11+
"JFP Template Override Profiling";
12+
private static final String EXCEPTION_SAMPLE_RATE_LIMIT_KEY = "Exception Sample Rate Limit";
13+
private static final String EXCEPTION_HISTO_REPORT_LIMIT_KEY = "Exception Histo Report Limit";
14+
private static final String EXCEPTION_HISTO_SIZE_LIMIT_KEY = "Exception Histo Size Limit";
15+
private final String jfrImplementation;
16+
17+
public JfrProfilerSettings() {
18+
super(ConfigProvider.getInstance());
19+
this.jfrImplementation =
20+
Platform.isNativeImage()
21+
? "native-image"
22+
: (Platform.isOracleJDK8() ? "oracle" : "openjdk");
23+
}
24+
825
public void publish() {
926
if (new ProfilerSettingEvent(null, null, null).isEnabled()) {
10-
new ProfilerSettingEvent("Upload Period", String.valueOf(uploadPeriod), "seconds").commit();
11-
new ProfilerSettingEvent("Upload Timeout", String.valueOf(uploadTimeout), "seconds").commit();
12-
new ProfilerSettingEvent("Upload Compression", uploadCompression).commit();
13-
new ProfilerSettingEvent("Allocation Profiling", String.valueOf(allocationProfilingEnabled))
27+
new ProfilerSettingEvent(UPLOAD_PERIOD_KEY, String.valueOf(uploadPeriod), "seconds").commit();
28+
new ProfilerSettingEvent(UPLOAD_TIMEOUT_KEY, String.valueOf(uploadTimeout), "seconds")
1429
.commit();
15-
new ProfilerSettingEvent("Heap Profiling", String.valueOf(heapProfilingEnabled)).commit();
16-
new ProfilerSettingEvent("Force Start-First", String.valueOf(startForceFirst)).commit();
17-
new ProfilerSettingEvent("JFP Template Override Profiling", String.valueOf(templateOverride))
30+
new ProfilerSettingEvent(UPLOAD_COMPRESSION_KEY, uploadCompression).commit();
31+
new ProfilerSettingEvent(ALLOCATION_PROFILING_KEY, String.valueOf(allocationProfilingEnabled))
32+
.commit();
33+
new ProfilerSettingEvent(HEAP_PROFILING_KEY, String.valueOf(heapProfilingEnabled)).commit();
34+
new ProfilerSettingEvent(FORCE_START_FIRST_KEY, String.valueOf(startForceFirst)).commit();
35+
new ProfilerSettingEvent(
36+
JFP_TEMPLATE_OVERRIDE_PROFILING_KEY, String.valueOf(templateOverride))
1837
.commit();
1938
new ProfilerSettingEvent(
20-
"Exception Sample Rate Limit",
39+
EXCEPTION_SAMPLE_RATE_LIMIT_KEY,
2140
String.valueOf(exceptionSampleLimit),
2241
"exceptions/second")
2342
.commit();
2443
new ProfilerSettingEvent(
25-
"Exception Histo Report Limit", String.valueOf(exceptionHistogramTopItems))
44+
EXCEPTION_HISTO_REPORT_LIMIT_KEY, String.valueOf(exceptionHistogramTopItems))
2645
.commit();
2746
new ProfilerSettingEvent(
28-
"Exception Histo Size Limit", String.valueOf(exceptionHistogramMaxSize))
47+
EXCEPTION_HISTO_SIZE_LIMIT_KEY, String.valueOf(exceptionHistogramMaxSize))
2948
.commit();
30-
new ProfilerSettingEvent("Hotspots", String.valueOf(hotspotsEnabled)).commit();
31-
new ProfilerSettingEvent("Endpoints", String.valueOf(endpointsEnabled)).commit();
32-
new ProfilerSettingEvent("Auxiliary Profiler", auxiliaryProfiler).commit();
33-
new ProfilerSettingEvent("perf_events_paranoid", perfEventsParanoid).commit();
34-
new ProfilerSettingEvent("Native Stacks", String.valueOf(hasNativeStacks)).commit();
49+
new ProfilerSettingEvent(HOTSPOTS_KEY, String.valueOf(hotspotsEnabled)).commit();
50+
new ProfilerSettingEvent(ENDPOINTS_KEY, String.valueOf(endpointsEnabled)).commit();
51+
new ProfilerSettingEvent(AUXILIARY_PROFILER_KEY, auxiliaryProfiler).commit();
52+
new ProfilerSettingEvent(PERF_EVENTS_PARANOID_KEY, perfEventsParanoid).commit();
53+
new ProfilerSettingEvent(NATIVE_STACKS_KEY, String.valueOf(hasNativeStacks)).commit();
54+
new ProfilerSettingEvent(JFR_IMPLEMENTATION_KEY, jfrImplementation).commit();
3555
}
3656
}
3757
}

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111

1212
/** Capture the profiler config first and allow emitting the setting events per each recording. */
1313
public abstract class ProfilerSettingsSupport {
14+
protected static final String JFR_IMPLEMENTATION_KEY = "JFR Implementation";
15+
protected static final String UPLOAD_PERIOD_KEY = "Upload Period";
16+
protected static final String UPLOAD_TIMEOUT_KEY = "Upload Timeout";
17+
protected static final String UPLOAD_COMPRESSION_KEY = "Upload Compression";
18+
protected static final String ALLOCATION_PROFILING_KEY = "Allocation Profiling";
19+
protected static final String HEAP_PROFILING_KEY = "Heap Profiling";
20+
protected static final String FORCE_START_FIRST_KEY = "Force Start-First";
21+
protected static final String HOTSPOTS_KEY = "Hotspots";
22+
protected static final String ENDPOINTS_KEY = "Endpoints";
23+
protected static final String AUXILIARY_PROFILER_KEY = "Auxiliary Profiler";
24+
protected static final String PERF_EVENTS_PARANOID_KEY = "perf_events_paranoid";
25+
protected static final String NATIVE_STACKS_KEY = "Native Stacks";
26+
1427
protected final int uploadPeriod;
1528
protected final int uploadTimeout;
1629
protected final String uploadCompression;
@@ -25,11 +38,9 @@ public abstract class ProfilerSettingsSupport {
2538
protected final boolean endpointsEnabled;
2639
protected final String auxiliaryProfiler;
2740
protected final String perfEventsParanoid;
28-
2941
protected final boolean hasNativeStacks;
3042

31-
protected ProfilerSettingsSupport() {
32-
ConfigProvider configProvider = ConfigProvider.getInstance();
43+
protected ProfilerSettingsSupport(ConfigProvider configProvider) {
3344
uploadPeriod =
3445
configProvider.getInteger(
3546
ProfilingConfig.PROFILING_UPLOAD_PERIOD,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /