public interface Segment
Layer
that has associated Condition
logic
for diversion and overrides to the default flag values.
There are two implementations of this interface. An experiment is a specific configuration of
conditions and flag overrides that describes a hypothesis that we are interested in testing. A domain
is a higher-level segment that can contain other Layer
instances (with their own Segment
s)
nested inside of it. Domains are a useful way of creating shared space for experiments that need to cut
across multiple layers (or even binaries) in order to be valid. They can also be used to create custom
partitions of the experiment space for long-running experiments or ones where there are concerns about
lingering after effects of the experiment on subjects.
Modifier and Type | Method and Description |
---|---|
void |
disable()
Turn off this segment, preventing it from diverting requests.
|
SortedSet<Integer> |
getBuckets()
|
long |
getEndTimeMsec()
Returns the time in milliseconds UTC that this segment stops diverting requests.
|
int |
getId()
The unique id of this
Segment instance in the current ExperimentSpace . |
int |
getLayerId()
The unique id of the
Layer that owns this Segment . |
long |
getStartTimeMsec()
Returns the time in milliseconds UTC that this segment starts diverting requests.
|
void |
handle(ExperimentState state,
List<DiversionCriterion> diversionCriteria,
Map<String,FlagValueCalculator<Object>> overrides,
Set<Integer> newExperimentIds)
Modify the given
overrides and update newExperimentIds with the ids of any experiments
that this request was diverted into. |
boolean |
isEnabled(long requestTimeMsec)
Returns true if this instance is enabled and capable of diverting requests at the given time.
|
boolean |
isValidFor(ExperimentState state)
Returns true if the given
ExperimentState satisfies the Condition instances associated with
this Segment . |
int getId()
Segment
instance in the current ExperimentSpace
.Segment
int getLayerId()
Layer
that owns this Segment
.long getStartTimeMsec()
long getEndTimeMsec()
boolean isEnabled(long requestTimeMsec)
requestTimeMsec
- the time of this request in millisecondsvoid disable()
boolean isValidFor(ExperimentState state)
ExperimentState
satisfies the Condition
instances associated with
this Segment
.state
- the current ExperimentState
void handle(ExperimentState state, List<DiversionCriterion> diversionCriteria, Map<String,FlagValueCalculator<Object>> overrides, Set<Integer> newExperimentIds)
overrides
and update newExperimentIds
with the ids of any experiments
that this request was diverted into.state
- the current ExperimentState
diversionCriteria
- the active diversion criteriaoverrides
- the current overrides to flag value calculationsnewExperimentIds
- the experiment ids that have been added on this diversion requestCopyright © 2013. All rights reserved.