Skip to content

Add DistinctCountSketch meter#131

Open
brharrington wants to merge 1 commit into
Netflix:mainfrom
brharrington:distinct-count-sketch
Open

Add DistinctCountSketch meter#131
brharrington wants to merge 1 commit into
Netflix:mainfrom
brharrington:distinct-count-sketch

Conversation

@brharrington

Copy link
Copy Markdown
Contributor

Adds a distinct count sketch client that estimates the number of distinct values seen during a step interval using a HyperLogLog sketch, matching the spectator-java and spectatord implementations so sketches merge correctly.

Uses the 's' precomputed-hash line type: the client computes the xxHash64 (seed 0) of the value locally via github.com/cespare/xxhash/v2 and sends 's:name,tags:' to SpectatorD, which derives the registers. Integers are hashed as their 8-byte little-endian representation and strings as their UTF-8 bytes, matching the other clients. Provides RecordString, RecordBytes, and RecordInt64.

Wires the meter into the Registry interface and implementation (DistinctCountSketch and DistinctCountSketchWithId), and pulls in the shared cross-language test vector file with a test that verifies the hash and the emitted line against it for every vector input.

Adds a distinct count sketch client that estimates the number of distinct
values seen during a step interval using a HyperLogLog sketch, matching the
spectator-java and spectatord implementations so sketches merge correctly.

Uses the 's' precomputed-hash line type: the client computes the xxHash64
(seed 0) of the value locally via github.com/cespare/xxhash/v2 and sends
's:name,tags:<hash>' to SpectatorD, which derives the registers. Integers
are hashed as their 8-byte little-endian representation and strings as their
UTF-8 bytes, matching the other clients. Provides RecordString, RecordBytes,
and RecordInt64.

Wires the meter into the Registry interface and implementation
(DistinctCountSketch and DistinctCountSketchWithId), and pulls in the shared
cross-language test vector file with a test that verifies the hash and the
emitted line against it for every vector input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant