Skip to content

Commit

Permalink
update sample check
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljackins committed Oct 11, 2024
1 parent b8e7ef7 commit 0d96d2d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/signals/signals/src/core/signals/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class SignalGlobalSettings {
ingestClient: SignalsIngestSettingsConfig
network: NetworkSettingsConfig

private sampleRate = 0
private sampleSuccess = false
private signalsDebug = new SignalsDebugSettings()

constructor(settings: SignalsSettingsConfig) {
Expand All @@ -58,7 +58,7 @@ export class SignalGlobalSettings {
if (this.signalsDebug.getSignalsDebug()) {
return true
}
if (Math.random() > this.sampleRate) {
if (!this.sampleSuccess) {
return false
}
return false
Expand Down Expand Up @@ -99,7 +99,9 @@ export class SignalGlobalSettings {
Boolean(val)
)
)
this.sampleRate = sampleRate
if (Math.random() <= sampleRate) {
this.sampleSuccess = true
}
}
}

Expand Down

0 comments on commit 0d96d2d

Please sign in to comment.