assign

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package assign is the single source of cohort assignment. The fleet agent, the Kong plugin and halo-shadow all call it, so a user lands in the same ring and variant everywhere without any shared state.

Index

Constants

View Source
const Buckets = 10000

Buckets is the assignment resolution: 10000 = 0.01% granularity.

Variables

This section is empty.

Functions

func Bucket

func Bucket(salt, subject string) int

Bucket deterministically maps (salt, subject) to [0, Buckets).

func Pick

func Pick(salt, subject string, weights []float64) int

Pick returns the index of the weighted choice for subject, or -1 if weights are empty/zero.

func Share

func Share(fraction float64) int

Share converts a fraction of the population (0.0057 = 0.57%) to a bucket count, rounded to nearest so float error can't drop a bucket (0.0057 * Buckets is 56.99...). Every percent/sample-rate cut goes through here.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL