Repository navigation
Added
- Holdouts (
ContextData::holdouts,HoldoutData,ExperimentData::holdoutIds
andExperimentData::holdoutType, all new fields appended last and empty by
default). An experiment covered by a holdout that holds the unit out
(arm 0, or arm 1 of a three-arm holdout for an experiment that is not
full-on) returns variant 0 with control variables and publishes no exposure
of its own; each covering holdout publishes one ordinary exposure per unit
type. Overrides and matching assignment rules win over a holdout. Payloads
without holdouts assign and publish exactly as before. A holdout arm is
chosen with javascript-sdk's probability scale, so a unit whose hash lands
exactly on a split boundary gets the same arm in every SDK. Ports
javascript-sdk#65 and java-sdk#12. - Shared variable keys with holdouts, as in java-sdk: a held-out candidate
never wins a key over a candidate the unit is in; when no candidate wins, the
first held-out candidate supplies its control value (or the caller default
if its variant lacks the key).variable_value()publishes the holdout
exposures of every candidate it checks, and the winner's own exposure only
when the winner is not held out.peek_variable_value()publishes nothing. containsoperator, an alias ofin, so the app can start sending
contains. The C++ evaluator has registeredcontainsas the same
operator asin(haystack first, then needle) since 1.0.0; 1.1.0 documents
it and tests everyincase through both names.inis unchanged.ClientConfig::application_version: the application version sent as
X-Application-Version. A whole number of 1 to 18 digits is sent as-is;
anything else (such as2.4.1) is sent as0, as in java-sdk and
javascript-sdk.ClientConfigkeeps its 1.0.0 four-element
structured-binding shape.
Fixed
X-Application-Versionwas always0. Every 1.0.x client sent
X-Application-Version: 0on context fetches and publishes, and there was no
option to set it, so the collector could not attribute events to an
application version. This affects every C++ SDK user who reports on or
targets application versions; setClientConfig::application_versionto
send yours. Clients that leave it empty still send0.
Notes
-
New fields grow the public model and
Contextlayouts; rebuild everything
that includes the SDK headers when upgrading (see Installed Package in the
README).ContextDataandExperimentDatakeep their 1.0.0
structured-binding shapes (1 and 19 elements); reachholdouts,
holdoutIdsandholdoutTypeby name. A type derived from either one has
no such shape: a structured binding of it now binds every member (2 and 21
names). The same holds forClientConfig(4 elements;application_version
by name). Code that aggregate-initializesExperimentData,ContextDataor
ClientConfigpositionally still compiles, but-Wextrareports the
appended fields as missing initializers. -
Cached reads cost the same as in 1.0.1 or less. Measured with GCC 15.2 on
aarch64 with 50 experiments and no holdouts, other paths are slower: the
first resolution of each experiment by about 2-3% (firstpeek()295 to
304 ns, firsttreatment()2,168 to 2,184 ns, with the same allocation
count), partly from the 24-byte larger cached assignment and partly from
the holdout checks; andrefresh()by about 12% (112 to 126 us, 151 more
allocations), because it copies the new payload into fresh storage before
installing it (see below). -
refresh()copies and indexes the new payload before installing it, so a
std::bad_allocwhile doing so leaves the previous data installed and
readable. As in 1.0.1, an allocation failure inside a nlohmann/json
destructor during that copy still terminates the process. -
All exposures of one
treatment()call on a covered experiment, and of one
variable_value()call (its holdouts' and the winner's), are queued before
the event logger sees the first of them, so a logger that callsfinalize()
orpublish()from that callback sends them all, as javascript-sdk 1.14
does.