Repository navigation
test(writer): hash with CityHash in writer tests, as deployments do - #1084
Merged
rita7lopes merged 1 commit intoNov 24, 2026
Merged
Conversation
The writer tests that install a minimal global config left FingerPrintType at its zero value, which is Bernstein, while a real deployment defaults to CityHash. Set CityHash explicitly in those helpers (writer/controller, writer/grpc, writer/utils/unmarshal), so the tests hash the way production does. Follow-up from metrico#1060.
8 tasks
rita7lopes
approved these changes
Nov 24, 2026
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.
Follow-up 4 from #1060. No dependencies: branches from
master.Why
Writer tests that install a minimal global config leave
FingerPrintTypeat its zero value,0, which is Bernstein. A real deployment defaults to CityHash (FingerPrintTypedefault1). So these tests hashed every series with an algorithm production doesn't use by default.What
Test files only. The helpers that install the config now select CityHash:
writer/utils/unmarshal/otlp_metrics_test.gocollectMetricscallsuseFingerprintType(t, clcwriter.FINGERPRINT_CityHash)(the helper #1060 added in the same package)writer/utils/unmarshal/otlplogs_grpc_test.goTestOTLPLogsFromData_EmitsSampleswriter/controller/ingest_test.goinstallConfigsetssetting.FingerPrintType = clcwriter.FINGERPRINT_CityHashwriter/grpc/integration_test.goinstallConfigNo assertion changes. None of these tests compare against fixed fingerprint values.
Verification
Which mode the tests hash with, measured with a temporary print in
fingerprintLabels(not committed), excluding test(writer): pin label fingerprint values (M2 1/4, #991) #1060's own tests, which cover both modes on purpose:masterwriter/controllerwriter/grpcwriter/utils/unmarshalThe tests now cover the default hash. With a bug planted in the CityHash branch of
fingerprintLabels(every fingerprint 0), the tests above all pass onmasterand fail on this branch (8TestOTLPMetrics_*tests and more). Not committed.go test ./...: 36 packages pass;go test -raceon the three packages passes; the affected tests pass 5 runs in a rowgo vet ./...same asmaster;gofmtclean; build OKPotential risks
hash_type: "default", see hash_type "bernstein" keeps CityHash; only "default" selects Bernstein cloki-config#9) are exercised by the fingerprint pins only, not by these ingest tests.