Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt committed May 11, 2024
1 parent 9be53ae commit 5999ea6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
4 changes: 2 additions & 2 deletions go/streamlog/streamlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ func GetFormatter[T any](logger *StreamLogger[T]) LogFormatter {
func shouldSampleQuery() bool {
if queryLogSampleRate <= 0 {
return false
} else if queryLogSampleRate >= 1.0 {
} else if queryLogSampleRate >= 1 {
return true
}
return rand.Float64() <= queryLogSampleRate
return rand.Float64() < queryLogSampleRate
}

// ShouldEmitLog returns whether the log with the given SQL query
Expand Down
9 changes: 0 additions & 9 deletions go/streamlog/streamlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,6 @@ func TestShouldEmitLog(t *testing.T) {
rowsReturned: 17,
ok: true,
},
{
sql: "this contains out-of-bounds querySampleRate: 123.0",
qLogFilterTag: "",
qLogRowThreshold: 0,
qLogSampleRate: 123.0,
rowsAffected: 7,
rowsReturned: 17,
ok: true,
},
{
sql: "this contains querySampleRate: 1.0 without expected queryFilterTag",
qLogFilterTag: "TAG",
Expand Down

0 comments on commit 5999ea6

Please sign in to comment.