Skip to content

Commit 9e8c9c2

Browse files
authored
Rename debugger config to dynamic instrumentation (#8332)
* Rename debugger config to dynamic instrumentation Originally the config parameter was debuggerXXX. when the product was rolled out we use the term dynamic instrumentation. Now that we will introduce the live debugger in itself, it's confusing to keep debugger everywhere. First step is to rename dynamic instrumentation config tokens to reflect the fact that they are belonging to Dynamic Instrumentation part of the product * missed one
1 parent 99d7952 commit 9e8c9c2

File tree

40 files changed

+367
-313
lines changed

40 files changed

+367
-313
lines changed

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ private enum AgentFeature {
100100
propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_AGENTLESS_ENABLED), false),
101101
USM(propertyNameToSystemPropertyName(UsmConfig.USM_ENABLED), false),
102102
TELEMETRY(propertyNameToSystemPropertyName(GeneralConfig.TELEMETRY_ENABLED), true),
103-
DEBUGGER(propertyNameToSystemPropertyName(DebuggerConfig.DEBUGGER_ENABLED), false),
103+
DEBUGGER(
104+
propertyNameToSystemPropertyName(DebuggerConfig.DYNAMIC_INSTRUMENTATION_ENABLED), false),
104105
EXCEPTION_DEBUGGING(
105106
propertyNameToSystemPropertyName(DebuggerConfig.EXCEPTION_REPLAY_ENABLED), false),
106107
SPAN_ORIGIN(

dd-java-agent/agent-debugger/debugger-bootstrap/src/main/java/datadog/trace/bootstrap/debugger/DebuggerContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ public static void evalContext(
307307
// only freeze the context when we have at lest one snapshot probe, and we should send
308308
// snapshot
309309
if (needFreeze) {
310-
Duration timeout = Duration.of(Config.get().getDebuggerCaptureTimeout(), ChronoUnit.MILLIS);
310+
Duration timeout =
311+
Duration.of(Config.get().getDynamicInstrumentationCaptureTimeout(), ChronoUnit.MILLIS);
311312
context.freeze(new TimeoutChecker(timeout));
312313
}
313314
} catch (Exception ex) {

dd-java-agent/agent-debugger/debugger-bootstrap/src/main/java/datadog/trace/bootstrap/debugger/util/Redaction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ static void initKeywords() {
117117
* based on sentry list: https://github.com/getsentry/sentry-python/blob/fefb454287b771ac31db4e30fa459d9be2f977b8/sentry_sdk/scrubber.py#L17-L58
118118
*/
119119
KEYWORDS.addAll(PREDEFINED_KEYWORDS);
120-
KEYWORDS.removeAll(Config.get().getDebuggerRedactionExcludedIdentifiers());
120+
KEYWORDS.removeAll(Config.get().getDynamicInstrumentationRedactionExcludedIdentifiers());
121121
}
122122

123123
public static void addUserDefinedKeywords(Config config) {
124-
String redactedIdentifiers = config.getDebuggerRedactedIdentifiers();
124+
String redactedIdentifiers = config.getDynamicInstrumentationRedactedIdentifiers();
125125
if (redactedIdentifiers == null) {
126126
return;
127127
}
@@ -132,7 +132,7 @@ public static void addUserDefinedKeywords(Config config) {
132132
}
133133

134134
public static void addUserDefinedTypes(Config config) {
135-
String redactedTypes = config.getDebuggerRedactedTypes();
135+
String redactedTypes = config.getDynamicInstrumentationRedactedTypes();
136136
if (redactedTypes == null) {
137137
return;
138138
}

dd-java-agent/agent-debugger/debugger-bootstrap/src/test/java/datadog/trace/bootstrap/debugger/util/RedactionTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void basic() {
2828
@Test
2929
public void userDefinedKeywords() {
3030
Config config = Config.get();
31-
setFieldInConfig(config, "debuggerRedactedIdentifiers", "_MotDePasse,$Passwort");
31+
setFieldInConfig(config, "dynamicInstrumentationRedactedIdentifiers", "_MotDePasse,$Passwort");
3232
try {
3333
Redaction.addUserDefinedKeywords(config);
3434
assertTrue(Redaction.isRedactedKeyword("mot-de-passe"));
@@ -41,7 +41,8 @@ public void userDefinedKeywords() {
4141
@Test
4242
public void userDefinedTypes() {
4343
Config config = Config.get();
44-
setFieldInConfig(config, "debuggerRedactedTypes", "java.security.Security,javax.security.*");
44+
setFieldInConfig(
45+
config, "dynamicInstrumentationRedactedTypes", "java.security.Security,javax.security.*");
4546
try {
4647
Redaction.addUserDefinedTypes(Config.get());
4748
assertTrue(Redaction.isRedactedType("java.security.Security"));
@@ -55,12 +56,15 @@ public void userDefinedTypes() {
5556
public void exclusions() {
5657
Config config = Config.get();
5758
setFieldInConfig(
58-
config, "debuggerRedactionExcludedIdentifiers", new HashSet<>(Arrays.asList("password")));
59+
config,
60+
"dynamicInstrumentationRedactionExcludedIdentifiers",
61+
new HashSet<>(Arrays.asList("password")));
5962
Redaction.initKeywords();
6063
try {
6164
assertFalse(Redaction.isRedactedKeyword("password"));
6265
} finally {
63-
setFieldInConfig(config, "debuggerRedactionExcludedIdentifiers", Collections.emptySet());
66+
setFieldInConfig(
67+
config, "dynamicInstrumentationRedactionExcludedIdentifiers", Collections.emptySet());
6468
Redaction.initKeywords();
6569
}
6670
}

dd-java-agent/agent-debugger/debugger-el/src/test/java/com/datadog/debugger/el/expressions/GetMemberExpressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void redactedType() {
8686
Config config = Config.get();
8787
setFieldInConfig(
8888
config,
89-
"debuggerRedactedTypes",
89+
"dynamicInstrumentationRedactedTypes",
9090
"com.datadog.debugger.el.expressions.GetMemberExpressionTest*");
9191
try {
9292
Redaction.addUserDefinedTypes(Config.get());

dd-java-agent/agent-debugger/debugger-el/src/test/java/com/datadog/debugger/el/expressions/IndexExpressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void redactedType() {
110110
Config config = Config.get();
111111
setFieldInConfig(
112112
config,
113-
"debuggerRedactedTypes",
113+
"dynamicInstrumentationRedactedTypes",
114114
"com.datadog.debugger.el.expressions.IndexExpressionTest*");
115115
try {
116116
Redaction.addUserDefinedTypes(Config.get());

dd-java-agent/agent-debugger/debugger-el/src/test/java/com/datadog/debugger/el/expressions/ValueRefExpressionTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public void redacted() {
125125
@Test
126126
public void redactedType() {
127127
Config config = Config.get();
128-
setFieldInConfig(config, "debuggerRedactedTypes", "com.datadog.debugger.el.expressions.*");
128+
setFieldInConfig(
129+
config, "dynamicInstrumentationRedactedTypes", "com.datadog.debugger.el.expressions.*");
129130
try {
130131
Redaction.addUserDefinedTypes(Config.get());
131132
ValueRefExpression valueRef = new ValueRefExpression("store");

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/agent/DebuggerAgent.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ public static synchronized void run(
103103
LOGGER.info("Starting Code Origin for spans");
104104
DebuggerContext.initCodeOrigin(new DefaultCodeOriginRecorder(config, configurationUpdater));
105105
}
106-
if (config.isDebuggerInstrumentTheWorld()) {
106+
if (config.isDynamicInstrumentationInstrumentTheWorld()) {
107107
setupInstrumentTheWorldTransformer(
108108
config, instrumentation, debuggerSink, statsdMetricForwarder);
109109
}
110110
// Dynamic Instrumentation
111-
if (config.isDebuggerEnabled()) {
111+
if (config.isDynamicInstrumentationEnabled()) {
112112
startDynamicInstrumentation(
113113
instrumentation, sco, config, configurationUpdater, debuggerSink, classNameFilter);
114114
}
@@ -137,10 +137,11 @@ private static void startDynamicInstrumentation(
137137
DebuggerSink debuggerSink,
138138
ClassNameFilter classNameFilter) {
139139
LOGGER.info("Starting Dynamic Instrumentation");
140-
String probeFileLocation = config.getDebuggerProbeFileLocation();
140+
String probeFileLocation = config.getDynamicInstrumentationProbeFile();
141141
if (probeFileLocation != null) {
142142
Path probeFilePath = Paths.get(probeFileLocation);
143-
loadFromFile(probeFilePath, configurationUpdater, config.getDebuggerMaxPayloadSize());
143+
loadFromFile(
144+
probeFilePath, configurationUpdater, config.getDynamicInstrumentationMaxPayloadSize());
144145
return;
145146
}
146147
configurationPoller = sco.configurationPoller(config);

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/agent/DebuggerTransformer.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public DebuggerTransformer(
119119
this.denyListHelper = new DenyListHelper(configuration.getDenyList());
120120
this.listener = listener;
121121
this.debuggerSink = debuggerSink;
122-
this.instrumentTheWorld = config.isDebuggerInstrumentTheWorld();
122+
this.instrumentTheWorld = config.isDynamicInstrumentationInstrumentTheWorld();
123123
if (this.instrumentTheWorld) {
124124
instrumentTheWorldProbes = new ConcurrentHashMap<>();
125125
excludeTrie = new Trie();
@@ -129,9 +129,15 @@ public DebuggerTransformer(
129129
includeClasses = new HashSet<>();
130130
includeMethods = new HashSet<>();
131131
processITWFiles(
132-
config.getDebuggerExcludeFiles(), excludeTrie, excludeClasses, excludeMethods);
132+
config.getDynamicInstrumentationExcludeFiles(),
133+
excludeTrie,
134+
excludeClasses,
135+
excludeMethods);
133136
processITWFiles(
134-
config.getDebuggerIncludeFiles(), includeTrie, includeClasses, includeMethods);
137+
config.getDynamicInstrumentationIncludeFiles(),
138+
includeTrie,
139+
includeClasses,
140+
includeMethods);
135141
} else {
136142
instrumentTheWorldProbes = null;
137143
excludeTrie = null;
@@ -445,7 +451,7 @@ private byte[] writeClassFile(
445451
}
446452

447453
private void verifyByteCode(String classFilePath, byte[] classFile) {
448-
if (!config.isDebuggerVerifyByteCode()) {
454+
if (!config.isDynamicInstrumentationVerifyByteCode()) {
449455
return;
450456
}
451457
StringWriter stringWriter = new StringWriter();
@@ -831,7 +837,7 @@ private MethodNode matchSourceFile(
831837
}
832838

833839
private void dumpInstrumentedClassFile(String className, byte[] data) {
834-
if (config.isDebuggerClassFileDumpEnabled()) {
840+
if (config.isDynamicInstrumentationClassFileDumpEnabled()) {
835841
log.debug("Generated bytecode len: {}", data.length);
836842
Path classFilePath = dumpClassFile(className, data);
837843
if (classFilePath != null) {
@@ -841,7 +847,7 @@ private void dumpInstrumentedClassFile(String className, byte[] data) {
841847
}
842848

843849
private void dumpOriginalClassFile(String className, byte[] classfileBuffer) {
844-
if (config.isDebuggerClassFileDumpEnabled()) {
850+
if (config.isDynamicInstrumentationClassFileDumpEnabled()) {
845851
Path classFilePath = dumpClassFile(className + "_orig", classfileBuffer);
846852
if (classFilePath != null) {
847853
log.debug("Original class saved as: {}", classFilePath.toString());

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/codeorigin/DefaultCodeOriginRecorder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private CodeOriginProbe createProbe(String fingerPrint, boolean entry, Where whe
115115

116116
// i think this check is unnecessary at this point time but leaving for now to be safe
117117
if (installed == null) {
118-
if (Config.get().isDebuggerEnabled()) {
118+
if (Config.get().isDynamicInstrumentationEnabled()) {
119119
registerLogProbe(probe);
120120
}
121121
installProbes();

0 commit comments

Comments
 (0)