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 @@ -458,7 +458,7 @@ public void initSamplers() {
double rate =
sampling != null
? sampling.getEventsPerSecond()
: (isCaptureSnapshot()
: (isFullSnapshot()
? ProbeRateLimiter.DEFAULT_SNAPSHOT_RATE
: ProbeRateLimiter.DEFAULT_LOG_RATE);
sampler = ProbeRateLimiter.createSampler(rate);
Expand Down Expand Up @@ -502,7 +502,7 @@ public InstrumentationResult.Status instrument(
public boolean isReadyToCapture() {
if (!hasCondition()) {
// we are sampling here to avoid creating CapturedContext when the sampling result is negative
return ProbeRateLimiter.tryProbe(sampler, isCaptureSnapshot());
return ProbeRateLimiter.tryProbe(sampler, isFullSnapshot());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use snapshot per-probe rate for capture expressions

For a capture-expression log probe without explicit sampling, this now selects the snapshot global limiter, but initSamplers() still builds sampler with DEFAULT_LOG_RATE whenever captureSnapshot(false) is set. In that scenario the per-probe limiter remains 5000/s even though capture expressions are committed as full snapshots, so one probe can overproduce until the global snapshot budget is exhausted; base the default sampler rate on isFullSnapshot() as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}
return true;
}
Expand Down Expand Up @@ -570,10 +570,10 @@ private void sample(LogStatus logStatus, MethodLocation methodLocation) {
// if condition has error and no capture Snapshot, the error is reported using errorSampler
// at 1/s rate instead of the log template one
Sampler localSampler =
logStatus.hasConditionErrors && !isCaptureSnapshot() ? errorSampler : sampler;
logStatus.hasConditionErrors && !isFullSnapshot() ? errorSampler : sampler;
boolean sampled =
!logStatus.getDebugSessionStatus().isDisabled()
&& ProbeRateLimiter.tryProbe(localSampler, isCaptureSnapshot());
&& ProbeRateLimiter.tryProbe(localSampler, isFullSnapshot());
logStatus.setSampled(sampled);
if (!sampled) {
DebuggerAgent.getSink()
Expand Down
Loading
Loading