calculations

package
v0.0.0-...-51bb0a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPercentagePerAlteration

func GetPercentagePerAlteration(endpointSpecList []*pb.AlterationSpec) (map[AlterationConfiguration]QueryPercent, error)

GetPercentagePerAlteration takes a series of alterations configured for a target endpoint and returns a mapping from the alteration to the percentage of queries which will be altered by it

Types

type AlterationConfiguration

type AlterationConfiguration struct {
	ErrorToReturn    string
	OverrideToReturn string
}

AlterationConfiguration contains either an ErrorToReturn or an OverrideToReturn for a given gRPC query to the disrupted service.

func ConvertSpecifications

func ConvertSpecifications(endpointSpecList []*pb.AlterationSpec) ([]AlterationConfiguration, error)

ConvertSpecifications takes a series of alterations configured for a target endpoint where assignments are distributed based on percentage odds (QueryPercent) expected for different return alterations and returns a slice where the slice's "index" between 0 and some number less than 100 are assigned Alterations which reappear as many times as the requested query percentage

func FlattenAlterationMap

func FlattenAlterationMap(alterationToQueryPercent map[AlterationConfiguration]QueryPercent) []AlterationConfiguration

FlattenAlterationMap takes a mapping from alterationConfiguration to the percentage of requests and returns a slice where the slice's "index" between 0 and some number less than 100 are assigned Alterations which reappear as many times as the requested query percentage

type DisruptionConfiguration

type DisruptionConfiguration map[TargetEndpoint]EndpointConfiguration

DisruptionConfiguration configures the DisruptionListener to chaos test endpoints of a gRPC server.

type EndpointConfiguration

type EndpointConfiguration struct {
	TargetEndpoint TargetEndpoint
	Alterations    []AlterationConfiguration
}

EndpointConfiguration configures endpoints that the DisruptionListener chaos tests on a gRPC server. The Alterations maps integers from 0 to 100 to alteration configurations.

type QueryPercent

type QueryPercent int

QueryPercent is an integer representing the percentage odds that a query for an endpoint is affected by a certain alteration.

type TargetEndpoint

type TargetEndpoint string

TargetEndpoint is a string of the format /package.service/method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL