Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow sampling based on decide response #839

Merged
merged 43 commits into from
Oct 24, 2023

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Oct 18, 2023

We want to give people the tools to control their replay spend.

This adds sampling based on decide response

tested locally

Screenshot 2023-10-19 at 17 45 12
  • sampling on the client
  • buffering until minimum duration is reached
  • allow flag to enable recordings by using the on_feature_flag hook

follow-up?

  • allow permanent buffering until manual flush

@pauldambra pauldambra added you-snizza-bo-logna bump minor Bump minor version when this PR gets merged labels Oct 18, 2023
@github-actions
Copy link

github-actions bot commented Oct 18, 2023

Size Change: +7.98 kB (+1%)

Total Size: 731 kB

Filename Size Change
dist/array.full.js 178 kB +2.01 kB (+1%)
dist/array.js 120 kB +1.99 kB (+2%)
dist/es.js 120 kB +1.99 kB (+2%)
dist/module.js 120 kB +1.99 kB (+2%)
dist/surveys.js 39.7 kB +15 B (0%)
ℹ️ View Unchanged
Filename Size
dist/recorder-v2.js 95.1 kB
dist/recorder.js 58.4 kB

compressed-size-action

Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

(talked in person about doing all the decision stuff only in the session manager class

src/extensions/sessionrecording.ts Outdated Show resolved Hide resolved
src/extensions/sessionrecording.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

Getting there! Small changes discussed in person

Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

Mostly comments but some things that I would at least like to have eyes on before we merge

src/extensions/replay/sessionrecording.ts Outdated Show resolved Hide resolved
src/extensions/replay/sessionrecording.ts Outdated Show resolved Hide resolved
src/extensions/replay/sessionrecording.ts Outdated Show resolved Hide resolved
src/extensions/replay/sessionrecording.ts Outdated Show resolved Hide resolved
src/extensions/replay/sessionrecording.ts Outdated Show resolved Hide resolved
src/extensions/replay/sessionrecording.ts Outdated Show resolved Hide resolved
src/extensions/replay/sessionrecording.ts Show resolved Hide resolved
Comment on lines +611 to +616
if (this.status === 'buffering' || isBelowMinimumDuration) {
this.flushBufferTimer = setTimeout(() => {
this._flushBuffer()
}, RECORDING_BUFFER_TIMEOUT)
return this.buffer || this.clearBuffer()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This addition comes with the new challenge of the buffer getting too big... If we buffer 15 seconds and then flush, it will essentially always buffer one super big event. Which is probably fine for now but would be interesting to see if that becomes an issue...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I backed away from the buffer until manual flush change in this PR. Partly cos it is getting massive but also because I think the flushing can be improved now we know we have checkout snapshots on an interval. We should be able to walk the buffer between those checkouts sending "complete" sections.

But the more we change here the harder it is to understand what might break 🙈

@pauldambra pauldambra merged commit 7606b0f into master Oct 24, 2023
13 checks passed
@pauldambra pauldambra deleted the feat/allow-sampling-based-on-decide-response branch October 24, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged you-snizza-bo-logna
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants