Liking cljdoc? Tell your friends :D

fieldtest.selector

The built-in selector, which splits units between arms by weight.

A selector is a function of one map and returns an arm keyword (or a promise of one):

{:experiment     "asset-host"
 :config         {:revision 3 :weights {:cdn 20} :sticky :hashed}
 :sticky-key     "user:8f3a"      ; may be nil
 :supported-arms #{:default :cdn}
 :context        {...}}            ; the decide request's context

Units fall into a space of 10,000 buckets. Each candidate arm, ordered by name, owns a fixed slice of 10,000/n buckets and draws the first weight*100 of them. Changing one arm's weight only moves units between that arm and :default. Adding or removing a candidate changes every slice, so do that with a new revision.

The built-in selector, which splits units between arms by weight.

A selector is a function of one map and returns an arm keyword (or a
promise of one):

    {:experiment     "asset-host"
     :config         {:revision 3 :weights {:cdn 20} :sticky :hashed}
     :sticky-key     "user:8f3a"      ; may be nil
     :supported-arms #{:default :cdn}
     :context        {...}}            ; the decide request's context

Units fall into a space of 10,000 buckets. Each candidate arm, ordered by
name, owns a fixed slice of 10,000/n buckets and draws the first
weight*100 of them. Changing one arm's weight only moves units between that
arm and `:default`. Adding or removing a candidate changes every slice, so do that
with a new revision.
raw docstring

arm-for-bucketclj/s

(arm-for-bucket weights bucket)

The arm whose drawn buckets contain bucket, else :default.

The arm whose drawn buckets contain `bucket`, else `:default`.
sourceraw docstring

bucketclj/s

(bucket {:keys [experiment config sticky-key]})

The bucket a request falls into: hashed when the experiment is hashed and the request has a sticky key, otherwise random.

The bucket a request falls into: hashed when the experiment is `hashed` and
the request has a sticky key, otherwise random.
sourceraw docstring

bucketsclj/s

Size of the bucket space.

Size of the bucket space.
sourceraw docstring

hash-bucketclj/s

(hash-bucket experiment revision sticky-key)

The bucket for a sticky key in hashed mode.

The bucket for a sticky key in `hashed` mode.
sourceraw docstring

random-bucketclj/s

(random-bucket)

A uniformly random bucket, for none mode.

A uniformly random bucket, for `none` mode.
sourceraw docstring

slicesclj/s

(slices weights)

Each candidate's slice of the bucket space as [arm start end], where [start end) are the buckets the arm draws. Candidates are ordered by name; a weight is clamped to its slice width.

Each candidate's slice of the bucket space as `[arm start end]`, where
`[start end)` are the buckets the arm draws. Candidates are ordered by name;
a weight is clamped to its slice width.
sourceraw docstring

weighted-hashclj/s

(weighted-hash {:keys [config supported-arms] :as request})

The built-in selector. If a unit's bucket belongs to an arm the client doesn't support, the unit gets :default. It isn't moved to another candidate, because that candidate would then get more than its weight.

The built-in selector. If a unit's bucket belongs to an arm the client
doesn't support, the unit gets `:default`. It isn't moved to another
candidate, because that candidate would then get more than its weight.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close