Documentation
¶
Index ¶
- Constants
- Variables
- func Data(ff FailureFlag, experiments []Experiment) (impacted bool, err error)
- func DefaultLogf(format string, p ...any) (n int, err error)
- func DelayedDataOrError(ff FailureFlag, experiments []Experiment) (bool, error)
- func DelayedPanicOrError(ff FailureFlag, experiments []Experiment) (bool, error)
- func Exception(ff FailureFlag, experiments []Experiment) (impacted bool, err error)
- func Invoke(ff FailureFlag) (active bool, impacted bool, err error)
- func Latency(ff FailureFlag, experiments []Experiment) (impacted bool, rerr error)
- func Panic(ff FailureFlag, experiments []Experiment) (bool, error)
- type AfterProxy
- type Behavior
- type Experiment
- type FailureFlag
- type LatencySpec
- type Logf
- type Requester
- type Selector
Constants ¶
View Source
const EffectData = `data`
View Source
const EffectException = `exception`
View Source
const EffectLatency = `latency`
View Source
const EffectPanic = `panic`
Variables ¶
View Source
var ( Version = `v1.0.0` VersionIdentifier = `go-` + Version LookupTimeout = 2 * time.Millisecond LookupBackoff = 5 * time.Minute )
exported variables
Functions ¶
func Data ¶
func Data(ff FailureFlag, experiments []Experiment) (impacted bool, err error)
func DelayedDataOrError ¶
func DelayedDataOrError(ff FailureFlag, experiments []Experiment) (bool, error)
func DelayedPanicOrError ¶
func DelayedPanicOrError(ff FailureFlag, experiments []Experiment) (bool, error)
func Exception ¶
func Exception(ff FailureFlag, experiments []Experiment) (impacted bool, err error)
func Latency ¶
func Latency(ff FailureFlag, experiments []Experiment) (impacted bool, rerr error)
func Panic ¶
func Panic(ff FailureFlag, experiments []Experiment) (bool, error)
Types ¶
type AfterProxy ¶
AfterProxy is defined here and used in this package to allow for greater testability
type Behavior ¶
type Behavior func(ff FailureFlag, experiments []Experiment) (impacted bool, err error)
Behavior functions
type Experiment ¶
type Experiment struct { // ID property is set by the control plane when the experiment is created. That // is used to centrally track experiment impact. ID string `json:"id"` // The experiment name as specified by the user in the Gremlin control plane. Name string `json:"name"` Protected bool `json:"protected"` FailureFlag Selector `json:"flag"` StartTime string `json:"startTime"` // Rate is a probability that the effect will be applied. Rate float64 `json:"rate"` // Effect is a config map specifying parameters for the test effect. The keys // and values carry no meaning in the experimentation platform. Interpretation is // an exercise left to the effect function. Effect map[string]json.RawMessage `json:"effect"` }
func FetchExperiment ¶
func FetchExperiment(ff FailureFlag) (result []Experiment, rerr error)
FetchExperiment makes a synchronous call to the sidecar service to retrieve any experiments targeting the provided FailureFlag. This function should never be allowed to propagate panics to the caller.
type FailureFlag ¶
type FailureFlag struct { // Used by the interaces to the SDK as well as provided via control plane Name string `json:"name"` Labels map[string]string `json:"labels"` // Used by the interfaces to the SDK Behavior Behavior `json:"-"` DataReference interface{} `json:"-"` // For debugging the SDK Logf Logf `json:"-"` }
type LatencySpec ¶
type Selector ¶
type Selector struct { // Name property identifies the codepoint being labeled. Use this property to // quickly identify HTTP ingress, HTTP egress, or dependencies. Name string `json:"name"` // Labels is a map of qualifying attributes and values. An experiment should apply // if and only if all selectors match a code point. Labels map[string][]string }
Click to show internal directories.
Click to hide internal directories.