Repository navigation
all: switch to math/rand/v2 - #954
Merged
Merged
Conversation
Top-level math/rand/v2 functions are safe for concurrent use and need no seeding, so the per-struct *rand.Rand fields and the locks around them go away. Two of those locks guarded nothing else: the one in the writer service registry, and the global one in the pattern controller, taken on every log line when pattern downsampling is on. The pattern controller's `random` was declared but never assigned, so skipLine() dereferenced a nil *rand.Rand as soon as downsampling was configured below 1. CLokiQueriable.random was written and copied but never read; drop it.
rita7lopes
approved these changes
Sep 2, 2026
rita7lopes
left a comment
Contributor
There was a problem hiding this comment.
Good one @janeblower !
Merging
tsouza
added a commit
to tsouza/gigapipe
that referenced
this pull request
Sep 4, 2026
Resolves the two real conflicts by hand: master's math/rand/v2 modernization (metrico#954) touched the same rand.Int64() lines this branch's determinism fix replaces with NextSubstituteName() -- kept this branch's fix, which fully supersedes the modernization (no rand import needed once the counter replaces random naming entirely). go.yml auto-merged cleanly, keeping both master's gofmt step and this branch's lint/-race/arch-lint additions.
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.
The top-level math/rand/v2 functions are safe for concurrent use and need no seeding, so the per-struct *rand.Rand fields and the locks guarding them can go. Two of those locks guarded nothing else: the one in the writer service registry, and the global one in the pattern controller, which was taken on every single log line whenever pattern downsampling was enabled.
Two bugs fell out along the way:
Mutexes that protect more than the generator (reader/registry/static.go, writer/service/generic_insert.go) are kept; only the lock around the rand call itself is dropped.
9 files, −29 lines. go build ./... and go test ./... pass.