gae: go.chromium.org/gae/filter/featureBreaker/flaky Index | Files

package flaky

import "go.chromium.org/gae/filter/featureBreaker/flaky"

Package flaky can be used to emulate flaky GAE errors that happen randomly with some probability.

NOTE: Emulates only datastore errors currently.

To install it:

ctx, fb := featureBreaker.FilterRDS(ctx, nil)
fb.BreakFeaturesWithCallback(
  flaky.Errors(...), featureBreaker.DatastoreFeatures...)

Index

Package Files

flaky.go

Variables

var ErrFlakyRPCDeadline = errors.New("simulated RPC deadline error")

ErrFlakyRPCDeadline is returned by FlakyErrors to indicate a deadline.

func Errors Uses

func Errors(params Params) featureBreaker.BreakFeatureCallback

Errors can be used to emulate flaky GAE errors that happen randomly with some probability.

NOTE: Emulates only datastore errors currently.

type Params Uses

type Params struct {
    // Rand is a source of pseudo-randomness to use.
    //
    // It will be accessed under a lock.
    //
    // By default it is new rand.NewSource(0).
    Rand interface {
        Int63() int64 // uniformly-distributed pseudo-random value in the range [0, 1<<63)
    }

    // DeadlineProbability is a probability of ErrFlakyRPCDeadline happening on
    // any of the calls that involve RPCs.
    //
    // Deadline can happen independently of other errors. For example,
    // a transaction can fail due to a deadline or due to a commit confict. These
    // events are assumed to be independent and their probabilities add up
    // accordingly.
    //
    // Default is 0 (no deadline errors at all).
    DeadlineProbability float64

    // ConcurrentTransactionProbability is a probability of datastore commit
    // returning ErrConcurrentTransaction.
    //
    // Default is 0 (no commit errors at all).
    ConcurrentTransactionProbability float64
}

Params define options for Errors

Package flaky imports 6 packages (graph). Updated 2018-08-15. Refresh now. Tools for package owners.