Skip to main content

build_segment_traits

Function build_segment_traits 

Source
fn build_segment_traits(
    traits: &mut Map<String, Value>,
    license_key: &ValidatedLicenseKey,
    build_info: &BuildInfo,
    helm_chart_version: Option<String>,
)
Expand description

Merges the build version and the license key’s identity and state into the collected traits.

The license key is the authoritative source for the organization and environment IDs. EnvironmentId::organization_id only matches the real organization in cloud SaaS, so we report the license key’s sub (organization) and aud (environment) instead.

Expiry is recomputed against the wall clock on every call rather than reusing the flag computed once at startup, so a key that lapses while environmentd keeps running is reported as expired. The expiration == 0 guard exempts the sentinel disabled/emulator key, whose zero expiration is not a real timestamp.