Liking cljdoc? Tell your friends :D

fieldtest.config

Reading and validating experiment configs.

A config source returns a map of experiment name to config, like this:

{"asset-host" {:revision 3 :weights {:cdn 20} :sticky :hashed}}

Input may be JSON-shaped (string keys, string arms and modes). normalize turns it into the shape above, with keyword arms and modes, and drops every experiment that is invalid.

Every experiment has a :default arm, the code that runs today. It has no weight; it gets every unit that isn't drawn into one of the weighted candidate arms.

Reading and validating experiment configs.

A config source returns a map of experiment name to config, like this:

    {"asset-host" {:revision 3 :weights {:cdn 20} :sticky :hashed}}

Input may be JSON-shaped (string keys, string arms and modes). `normalize`
turns it into the shape above, with keyword arms and modes, and drops every
experiment that is invalid.

Every experiment has a `:default` arm, the code that runs today. It has no
weight; it gets every unit that isn't drawn into one of the weighted
candidate arms.
raw docstring

cachedclj/s

(cached source)
(cached source
        {:keys [ttl-ms retry-ms clock]
         :or {ttl-ms 30000 retry-ms 5000 clock now-ms}})

Wraps a config source so it is called at most once per :ttl-ms (default 30,000). Calls made while a fetch is in progress wait for that fetch instead of starting another.

When a fetch fails, the error is passed through to the caller, so the server can fall back to its last good configs and report the problem. The source then isn't called again for :retry-ms (default 5,000); calls in that window get the same error. :clock returns the current time in milliseconds and is there for tests.

Wraps a config source so it is called at most once per `:ttl-ms`
(default 30,000). Calls made while a fetch is in progress wait for that
fetch instead of starting another.

When a fetch fails, the error is passed through to the caller, so the
server can fall back to its last good configs and report the problem. The
source then isn't called again for `:retry-ms` (default 5,000); calls in
that window get the same error. `:clock` returns the current time in
milliseconds and is there for tests.
sourceraw docstring

experiment-problemclj/s

(experiment-problem experiment config)

Why config is not a valid experiment config, or nil when it is.

Why `config` is not a valid experiment config, or nil when it is.
sourceraw docstring

normalizeclj/s

(normalize configs)

Normalizes the configs a config source returned, dropping invalid experiments. Returns nil when configs is not a map at all, so the caller can tell bad data from an empty config.

Normalizes the configs a config source returned, dropping invalid
experiments. Returns nil when `configs` is not a map at all, so the caller
can tell bad data from an empty config.
sourceraw docstring

normalize-experimentclj/s

(normalize-experiment experiment config)

The normalized form of one experiment's config, or nil when it is invalid.

The normalized form of one experiment's config, or nil when it is invalid.
sourceraw docstring

problemsclj/s

(problems configs)

Map of experiment name to the reason it is invalid, for every invalid experiment in configs.

Map of experiment name to the reason it is invalid, for every invalid
experiment in `configs`.
sourceraw docstring

sticky-modesclj/s

How the server treats a request's sticky key.

How the server treats a request's sticky key.
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