Skip to content

Commit 94bf2dd

Browse files
authored
fix freeze context only for capturing line probe (#7456)
non-capturing line probe should not freeze line context because it is useless and too expensive (add overhead)
1 parent f3954c9 commit 94bf2dd

File tree

1 file changed

+6
-6
lines changed
  • dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/probe

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,6 @@ public void commit(CapturedContext lineContext, int line) {
553553
if (status.shouldSend()) {
554554
snapshot.setTraceId(lineContext.getTraceId());
555555
snapshot.setSpanId(lineContext.getSpanId());
556-
if (isCaptureSnapshot()) {
557-
snapshot.addLine(lineContext, line);
558-
}
559556
snapshot.setMessage(status.getMessage());
560557
shouldCommit = true;
561558
}
@@ -564,9 +561,12 @@ public void commit(CapturedContext lineContext, int line) {
564561
shouldCommit = true;
565562
}
566563
if (shouldCommit) {
567-
// freeze context just before commit because line probes have only one context
568-
Duration timeout = Duration.of(Config.get().getDebuggerCaptureTimeout(), ChronoUnit.MILLIS);
569-
lineContext.freeze(new TimeoutChecker(timeout));
564+
if (isCaptureSnapshot()) {
565+
// freeze context just before commit because line probes have only one context
566+
Duration timeout = Duration.of(Config.get().getDebuggerCaptureTimeout(), ChronoUnit.MILLIS);
567+
lineContext.freeze(new TimeoutChecker(timeout));
568+
snapshot.addLine(lineContext, line);
569+
}
570570
commitSnapshot(snapshot, sink);
571571
return;
572572
}

0 commit comments

Comments
 (0)