Skip to content

Commit

Permalink
Update src/extensions/replay/sessionrecording.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Ben White <[email protected]>
  • Loading branch information
pauldambra and benjackwhite authored Oct 24, 2023
1 parent b2dbdd1 commit 64e9640
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/extensions/replay/sessionrecording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,12 @@ export class SessionRecording {
const storedIsSampled = this.isSampled

let shouldSample: boolean
if (!sessionIdChanged && _isBoolean(storedIsSampled)) {
shouldSample = storedIsSampled
} else {
if (sessionIdChanged || !_isBoolean(storedIsSampled)) {
const randomNumber = Math.random()
shouldSample = randomNumber < this.sampleRate

} else {
shouldSample = storedIsSampled
}

if (!shouldSample) {
Expand Down

0 comments on commit 64e9640

Please sign in to comment.