chaos_experiment

package
v0.0.0-...-a5db094 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedExperimentRunStats

type AggregatedExperimentRunStats struct {
	Id    string `bson:"_id"`
	Count int    `bson:"count"`
}

type AggregatedExperimentRuns

type AggregatedExperimentRuns struct {
	TotalFilteredExperimentRuns []TotalFilteredData      `bson:"total_filtered_experiment_runs"`
	FlattenedExperimentRuns     []FlattenedExperimentRun `bson:"flattened_experiment_runs"`
}

type AggregatedExperimentStats

type AggregatedExperimentStats struct {
	TotalExperiments         []TotalFilteredData             `bson:"total_experiments"`
	TotalFilteredExperiments []CategorizedExperimentRunStats `bson:"categorized_by_resiliency_score"`
}

type AggregatedExperiments

type AggregatedExperiments struct {
	TotalFilteredExperiments []TotalFilteredData              `bson:"total_filtered_experiments"`
	ScheduledExperiments     []ChaosExperimentsWithRunDetails `bson:"scheduled_experiments"`
}

type AggregatedExperimentsWithProbes

type AggregatedExperimentsWithProbes struct {
	TotalFilteredExperiments []TotalFilteredData              `bson:"total_filtered_experiments"`
	ScheduledExperiments     []ChaosExperimentsWithRunDetails `bson:"scheduled_experiments"`
	ProbesMatched            []ProbesMatched                  `bson:"probes_matched"`
}

type AvgResScore

type AvgResScore struct {
	Id  string   `bson:"_id"`
	Avg *float64 `bson:"avg"`
}

AvgResScore contains average resiliency score

type CategorizedExperimentRunStats

type CategorizedExperimentRunStats struct {
	Id    int `bson:"_id"`
	Count int `bson:"count"`
}

type ChaosExperimentRequest

type ChaosExperimentRequest struct {
	mongodb.ResourceDetails    `bson:",inline"`
	mongodb.Audit              `bson:",inline"`
	ProjectID                  string                `bson:"project_id"`
	ExperimentID               string                `bson:"experiment_id"`
	CronSyntax                 string                `bson:"cron_syntax"`
	InfraID                    string                `bson:"infra_id"`
	ExperimentType             ChaosExperimentType   `bson:"experiment_type"`
	Revision                   []ExperimentRevision  `bson:"revision"`
	IsCustomExperiment         bool                  `bson:"is_custom_experiment"`
	RecentExperimentRunDetails []ExperimentRunDetail `bson:"recent_experiment_run_details"` // stores the details of last 10 experiment runs
	TotalExperimentRuns        int                   `bson:"total_experiment_runs"`
}

ChaosExperimentRequest contains the required fields to be stored in the database for a chaos experiment input

type ChaosExperimentType

type ChaosExperimentType string
const (
	NonCronExperiment ChaosExperimentType = "experiment"
	CronExperiment    ChaosExperimentType = "cronexperiment"
	ChaosEngine       ChaosExperimentType = "chaosengine"
)

type ChaosExperimentsWithRunDetails

type ChaosExperimentsWithRunDetails struct {
	mongodb.ResourceDetails    `bson:",inline"`
	mongodb.Audit              `bson:",inline"`
	ProjectID                  string                                    `bson:"project_id"`
	ExperimentID               string                                    `bson:"experiment_id"`
	CronSyntax                 string                                    `bson:"cron_syntax"`
	Revision                   []ExperimentRevision                      `bson:"revision"`
	ExperimentType             ChaosExperimentType                       `bson:"experiment_type"`
	KubernetesInfraDetails     []chaos_infrastructure.ChaosInfra         `bson:"kubernetesInfraDetails"`
	LastExperimentRunDetails   []chaos_experiment_run.ChaosExperimentRun `bson:"lastExpRunDetails"`
	RecentExperimentRunDetails []ExperimentRunDetail                     `bson:"recent_experiment_run_details"` // stores the details of last 10 experiment runs
	TotalExperimentRuns        int                                       `bson:"total_experiment_runs"`
	AvgResScore                float64                                   `bson:"avg_resiliency_score"`
	IsCustomExperiment         bool                                      `bson:"is_custom_experiment"`
	IsRemoved                  bool                                      `bson:"is_removed"`
}

ChaosExperimentsWithRunDetails contains the required fields to be stored in the database for a chaos experiment input

type ExperimentDetails

type ExperimentDetails struct {
	ExperimentType     ChaosExperimentType  `bson:"experiment_type"`
	ExperimentName     string               `bson:"name"`
	IsCustomExperiment bool                 `bson:"is_custom_experiment"`
	Revision           []ExperimentRevision `bson:"revision"`
}

type ExperimentRevision

type ExperimentRevision struct {
	RevisionID         string             `bson:"revision_id"`
	ExperimentManifest string             `bson:"experiment_manifest"`
	UpdatedAt          int64              `bson:"updated_at"`
	Weightages         []*WeightagesInput `bson:"weightages"`
	Probes             []Probes           `bson:"probes"`
}

type ExperimentRunDetail

type ExperimentRunDetail struct {
	mongodb.Audit   `bson:",inline"`
	ProjectID       string   `bson:"project_id"`
	ExperimentRunID string   `bson:"experiment_run_id"`
	Phase           string   `bson:"phase"`
	NotifyID        *string  `bson:"notify_id"`
	ResiliencyScore *float64 `bson:"resiliency_score,omitempty"`
	Completed       bool     `bson:"completed"`
	RunSequence     int      `bson:"run_sequence"`
	Probe           []Probes `bson:"probes"`
}

type FaultEventMetadata

type FaultEventMetadata struct {
	FaultName             string   `bson:"fault_name"`
	ServiceIdentifier     []string `bson:"service_identifier"`
	EnvironmentIdentifier []string `bson:"environment_identifier"`
}

type FlattenedExperimentRun

type FlattenedExperimentRun struct {
	mongodb.Audit          `bson:",inline"`
	ProjectID              string                            `bson:"project_id"`
	ExperimentID           string                            `bson:"experiment_id"`
	ExperimentRunID        string                            `bson:"experiment_run_id"`
	CronSyntax             string                            `bson:"cron_syntax"`
	ExecutionData          string                            `bson:"execution_data"`
	RevisionID             string                            `bson:"revision_id"`
	InfraID                string                            `bson:"infra_id"`
	Phase                  string                            `bson:"phase"`
	NotifyID               *string                           `bson:"notify_id"`
	KubernetesInfraDetails []chaos_infrastructure.ChaosInfra `bson:"kubernetesInfraDetails,omitempty"`
	ExperimentDetails      []ExperimentDetails               `bson:"experiment"`
	ResiliencyScore        *float64                          `bson:"resiliency_score,string,omitempty"`
	FaultsPassed           *int                              `bson:"faults_passed,string,omitempty"`
	FaultsFailed           *int                              `bson:"faults_failed,string,omitempty"`
	FaultsAwaited          *int                              `bson:"faults_awaited,string,omitempty"`
	FaultsStopped          *int                              `bson:"faults_stopped,string,omitempty"`
	FaultsNA               *int                              `bson:"faults_na,string,omitempty"`
	TotalFaults            *int                              `bson:"total_faults,string,omitempty"`
	IsCustomExperiment     bool                              `bson:"is_custom_experiment"`
	Completed              bool                              `bson:"completed"`
	IsRemoved              bool                              `bson:"is_removed"`
	RunSequence            int64                             `bson:"run_sequence"`
}

type GetExperimentDetails

type GetExperimentDetails struct {
	ChaosExperimentsWithRunDetails `bson:"inline"`
	AvgResiliencyScore             []AvgResScore `bson:"avg_resiliency_score"`
}

GetExperimentDetails contains details to be returned by GetExperiment handler

type Operator

type Operator struct {
	// contains filtered or unexported fields
}

Operator is the model for cluster collection

func NewChaosExperimentOperator

func NewChaosExperimentOperator(mongodbOperator mongodb.MongoOperator) *Operator

NewChaosExperimentOperator returns a new instance of Operator

func (*Operator) CountChaosExperiments

func (c *Operator) CountChaosExperiments(ctx context.Context, query bson.D) (int64, error)

CountChaosExperiments returns total number of matched documents

func (*Operator) GetAggregateExperiments

func (c *Operator) GetAggregateExperiments(pipeline mongo.Pipeline) (*mongo.Cursor, error)

GetAggregateExperiments takes a mongo pipeline to retrieve the experiment details from the database

func (*Operator) GetExperiment

func (c *Operator) GetExperiment(ctx context.Context, query bson.D) (ChaosExperimentRequest, error)

GetExperiment takes a query parameter to retrieve the experiment details from the database

func (*Operator) GetExperiments

func (c *Operator) GetExperiments(query bson.D) ([]ChaosExperimentRequest, error)

GetExperiments takes a query parameter to retrieve the experiment details from the database

func (*Operator) GetExperimentsByInfraID

func (c *Operator) GetExperimentsByInfraID(infraID string) ([]ChaosExperimentRequest, error)

GetExperimentsByInfraID takes a infraID parameter to retrieve the experiment details from the database

func (*Operator) InsertChaosExperiment

func (c *Operator) InsertChaosExperiment(ctx context.Context, chaosExperiment ChaosExperimentRequest) error

InsertChaosExperiment takes details of a experiment and inserts into the database collection

func (*Operator) UpdateChaosExperiment

func (c *Operator) UpdateChaosExperiment(ctx context.Context, query bson.D, update bson.D, opts ...*options.UpdateOptions) error

UpdateChaosExperiment takes query and update parameters to update the experiment details in the database

func (*Operator) UpdateChaosExperiments

func (c *Operator) UpdateChaosExperiments(ctx context.Context, query bson.D, update bson.D) error

UpdateChaosExperiments takes query and update parameters to updates multiple experiment's details in the database

type ProbeAnnotations

type ProbeAnnotations struct {
	Name string     `json:"name"`
	Mode model.Mode `json:"mode"`
}

type Probes

type Probes struct {
	FaultName  string   `bson:"fault_name" json:"faultName"`
	ProbeNames []string `bson:"probe_names" json:"probeNames"`
}

Probes details containing fault name and the probe name which it was mapped to

type ProbesMatched

type ProbesMatched struct {
	FaultName  string   `bson:"fault_name"`
	ProbeNames []string `bson:"probe_names"`
}

type TotalFilteredData

type TotalFilteredData struct {
	Count int `bson:"count"`
}

type WeightagesInput

type WeightagesInput struct {
	FaultName string `bson:"fault_name"`
	Weightage int    `bson:"weightage"`
}

WeightagesInput contains the required fields to be stored in the database for a weightages input

Jump to

Keyboard shortcuts

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