Skip to content

Commit d928320

Browse files
jpbempeldevflow.devflow-routing-intake
andcommitted
Fix sampling log probe with capture expressions (#11571)
Fix sampling log probe with capture expressions A log probe with CaptureExpressions has captureSnapshot=false but this is not a log template so the sampling must be 1/s like a regular snapshot fix initSamplers Co-authored-by: devflow.devflow-routing-intake <[email protected]>
1 parent ad96559 commit d928320

2 files changed

Lines changed: 161 additions & 82 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public void initSamplers() {
458458
double rate =
459459
sampling != null
460460
? sampling.getEventsPerSecond()
461-
: (isCaptureSnapshot()
461+
: (isFullSnapshot()
462462
? ProbeRateLimiter.DEFAULT_SNAPSHOT_RATE
463463
: ProbeRateLimiter.DEFAULT_LOG_RATE);
464464
sampler = ProbeRateLimiter.createSampler(rate);
@@ -502,7 +502,7 @@ public InstrumentationResult.Status instrument(
502502
public boolean isReadyToCapture() {
503503
if (!hasCondition()) {
504504
// we are sampling here to avoid creating CapturedContext when the sampling result is negative
505-
return ProbeRateLimiter.tryProbe(sampler, isCaptureSnapshot());
505+
return ProbeRateLimiter.tryProbe(sampler, isFullSnapshot());
506506
}
507507
return true;
508508
}
@@ -570,10 +570,10 @@ private void sample(LogStatus logStatus, MethodLocation methodLocation) {
570570
// if condition has error and no capture Snapshot, the error is reported using errorSampler
571571
// at 1/s rate instead of the log template one
572572
Sampler localSampler =
573-
logStatus.hasConditionErrors && !isCaptureSnapshot() ? errorSampler : sampler;
573+
logStatus.hasConditionErrors && !isFullSnapshot() ? errorSampler : sampler;
574574
boolean sampled =
575575
!logStatus.getDebugSessionStatus().isDisabled()
576-
&& ProbeRateLimiter.tryProbe(localSampler, isCaptureSnapshot());
576+
&& ProbeRateLimiter.tryProbe(localSampler, isFullSnapshot());
577577
logStatus.setSampled(sampled);
578578
if (!sampled) {
579579
DebuggerAgent.getSink()

0 commit comments

Comments
 (0)