Skip to content

Commit 67ecceb

Browse files
committed
Constantify some magic values
1 parent d2d86ae commit 67ecceb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
/** Capture the profiler config first and allow emitting the setting events per each recording. */
2626
public abstract class ProfilerSettingsSupport {
2727
private static final Logger logger = LoggerFactory.getLogger(ProfilerSettingsSupport.class);
28+
private static final String STACKDEPTH_KEY = "stackdepth=";
29+
private static final int DEFAULT_JFR_STACKDEPTH = 64;
2830

2931
protected static final class ProfilerActivationSetting {
3032
public enum Ssi {
@@ -200,9 +202,9 @@ private static int getStackDepth() {
200202
.findFirst()
201203
.orElse(null);
202204
if (value != null) {
203-
int start = value.indexOf("stackdepth=");
205+
int start = value.indexOf(STACKDEPTH_KEY);
204206
if (start != -1) {
205-
start += "stackdepth=".length();
207+
start += STACKDEPTH_KEY.length();
206208
int end = value.indexOf(',', start);
207209
if (end == -1) {
208210
end = value.length();
@@ -214,7 +216,7 @@ private static int getStackDepth() {
214216
}
215217
}
216218
}
217-
return 64; // default stack depth if not set in JFR options
219+
return DEFAULT_JFR_STACKDEPTH; // default stack depth if not set in JFR options
218220
}
219221

220222
private static String getServiceInjection(ConfigProvider configProvider) {

0 commit comments

Comments
 (0)