Skip to content

Commit ae6f6db

Browse files
jpbempelevanchooly
authored andcommitted
Disable capture of entry values
Due to overhead induced by capturing entry values because we need to freeze them (serialize as Json) immediately before even know if we are sampling it or not, compared to the usefulness of having those values we only capture at exit by default. (cherry picked from commit d5d15f1)
1 parent 2b2be1e commit ae6f6db

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/probe/LogProbe.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ public Sampling getSampling() {
444444
@Override
445445
public InstrumentationResult.Status instrument(
446446
MethodInfo methodInfo, List<DiagnosticMessage> diagnostics, List<ProbeId> probeIds) {
447-
// if evaluation is at exit and with condition, skip collecting data at entry
448-
boolean captureEntry = !(getEvaluateAt() == MethodLocation.EXIT && hasCondition());
447+
// only capture entry values if explicitly not at Exit. By default, we are using evaluateAt=EXIT
448+
boolean captureEntry = getEvaluateAt() != MethodLocation.EXIT;
449449
return new CapturedContextInstrumentor(
450450
this,
451451
methodInfo,

dd-java-agent/agent-debugger/src/test/java/com/datadog/debugger/agent/CapturedSnapshotTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ public void methodProbeAtExit() throws IOException, URISyntaxException {
155155
int result = Reflect.onClass(testClass).call("main", "1").get();
156156
assertEquals(3, result);
157157
Snapshot snapshot = assertOneSnapshot(listener);
158-
assertCaptureArgs(snapshot.getCaptures().getEntry(), "arg", "java.lang.String", "1");
158+
// no entry values capture
159+
assertEquals(CapturedContext.EMPTY_CAPTURING_CONTEXT, snapshot.getCaptures().getEntry());
159160
assertCaptureArgs(snapshot.getCaptures().getReturn(), "arg", "java.lang.String", "1");
160161
assertTrue(snapshot.getDuration() > 0);
161162
assertTrue(snapshot.getStack().size() > 0);

0 commit comments

Comments
 (0)