Add support for wide event sampling - #7965
Merged
Merged
Conversation
lmac012
force-pushed
the
feature/lukasz/wide-event-sampling
branch
from
March 13, 2026 15:34
c82e058 to
f90de59
Compare
lmac012
force-pushed
the
feature/lukasz/wide-event-sampling
branch
from
March 16, 2026 15:25
f90de59 to
c2293f2
Compare
lmac012
force-pushed
the
feature/lukasz/wide-event-sampling
branch
2 times, most recently
from
June 26, 2026 08:51
3476a70 to
c746446
Compare
lmac012
marked this pull request as ready for review
June 26, 2026 09:37
Store sampleRate (Float, default 1.0) in the WideEventEntity, propagate it through the repository interface and mapper so it is available when events are later sent to the backend. Includes DB migration (v1→v2). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
flowStart() now accepts a sampleRate parameter (0.0–1.0). When an event is sampled out, SAMPLED_OUT_ID is returned immediately with zero disk I/O. All subsequent operations (flowStep, flowFinish, flowAbort, intervalStart, intervalEnd) on that ID are silent no-ops. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use event.samplingProbability instead of hardcoded value when building API and pixel payloads. Change GlobalSection.sampleRate type from Int to Float to match the stored value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lmac012
force-pushed
the
feature/lukasz/wide-event-sampling
branch
from
July 27, 2026 09:35
c746446 to
5cec301
Compare
Contributor
|
lmac012
force-pushed
the
feature/lukasz/wide-event-sampling
branch
from
July 27, 2026 10:29
5cec301 to
09d95d0
Compare
joshliebe
approved these changes
Jul 29, 2026
joshliebe
left a comment
Contributor
There was a problem hiding this comment.
Code makes sense and tested, works as expected ✅
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Task/Issue URL: https://app.asana.com/1/137249556945/project/1205648422731273/task/1213138183491587?focus=true
API proposal: https://app.asana.com/1/137249556945/project/1202552961248957/task/1213453461866489?focus=true
Description
Steps to test this PR
No UI changes
Note
Medium Risk
Touches statistics persistence, migration, and outbound telemetry shape; default 1.0 preserves existing behavior until features opt into lower rates.
Overview
Adds optional sampling to wide events so high-volume flows can record a fraction of journeys without call-site handling for dropped flows.
WideEventClient.flowStartnow acceptssamplingProbability(0.0–1.0, default 1.0). At start, a random draw decides whether to persist the flow; sampled-out runs returnSAMPLED_OUT_FLOW_IDand all laterflowStep/flowFinish/ interval / abort calls on that ID are no-ops with no DB writes. Kept flows store the probability on the row (Room v3 migration defaults legacy events to 1.0).API and analytics payloads now emit the stored rate instead of a fixed value:
global.sample_rateon the wide-event POST body andglobal.sample_rateon pixels. Cursor wide-events docs describe the parameter and sentinel behavior.Tests across app, VPN, PIR, subscriptions, and sync are updated for the new
flowStartarity;WideEventClientTestcovers validation, sampling, and sentinel no-ops.Reviewed by Cursor Bugbot for commit 09d95d0. Bugbot is set up for automated code reviews on this repo. Configure here.