Skip to main content

Module identity

Module identity 

Source
Expand description

Stable entity identity — the join key that makes correlation work across blocks.

Interning gives a resource a resource_id that is block-local by design (section 0). Correlation needs the opposite: a value that is identical whenever two resources denote the same running thing, and different otherwise, in any block, forever.

Attribute-set equality is not that value. A pod that starts reporting one extra attribute halfway through an hour would become two entities, and every “show me everything from this pod” answer would silently lose half its rows. That failure is invisible — the query succeeds and returns a plausible subset — which makes it the worst kind of bug to ship into a correlation feature.

So identity is a hash of only the attributes OpenTelemetry semantic conventions define as identifying, taken at the most specific level that is actually present. service.instance.id is specified as globally unique when combined with service.name and service.namespace, which makes that triple the primary candidate; the rest of the ladder covers the very common case of telemetry that predates it.

Structs§

Fnv 🔒
FNV-1a 64 with a splitmix64 finalizer. Hand-rolled because the hash has to be byte-stable across builds and across releases — DefaultHasher explicitly is not, and a key that changes when the binary is upgraded is not an identity.

Constants§

IDENTITY 🔒
Identity candidates, most specific first. A candidate matches when every one of its required keys is present; its optional keys join the hash when they are. First match wins.
NO_IDENTITY
No candidate matched, so this resource has no stable identity and correlation by entity is not answerable for it.

Functions§

find 🔒
hash64
FNV-1a 64 with a splitmix64 finalizer over raw bytes.
mix 🔒
FNV-1a alone avalanches poorly in the high bits; this is the splitmix64 finalizer, which is what makes the 64 bits worth 64 bits.
resource_key
The stable 64-bit identity of the entity described by attrs, or NO_IDENTITY if nothing identifying is present.