Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ public InstrumentationResult.Status instrument(

@Override
public boolean isReadyToCapture() {
if (isLineProbe() && !hasCondition()) {
// we are sampling here to avoid creating CapturedContext when the sampling result is negative
return ProbeRateLimiter.tryProbe(id);
}
return true;
}

Expand All @@ -494,9 +498,14 @@ public void evaluate(
if (!(status instanceof LogStatus)) {
throw new IllegalStateException("Invalid status: " + status.getClass());
}

LogStatus logStatus = (LogStatus) status;
if (!hasCondition()) {
if (isLineProbe() && !hasCondition()) {
// sampling was already done in isReadToCapture so we assume that if we are executing the
// current method it means the status should be sampled
if (!logStatus.getDebugSessionStatus().isDisabled()) {
logStatus.setSampled(true);
}
} else if (!hasCondition()) {
// sample when no condition associated
sample(logStatus, methodLocation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ private Builder createLog(String template) {
return LogProbe.builder()
.language(LANGUAGE)
.probeId(PROBE_ID)
.where("String.java", 42)
.template(template, parseTemplate(template));
}

Expand Down
Loading