kayenta

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientBaseURL

func ClientBaseURL(baseURL string) func(dc *DefaultClient)

func ClientHTTPClientFactory

func ClientHTTPClientFactory(factory HTTPClientFactory) func(dc *DefaultClient)

func DefaultHTTPClientFactory

func DefaultHTTPClientFactory() *http.Client

func UpsertCanaryConfigs

func UpsertCanaryConfigs(d *DefaultClient, application string, cc CanaryConfig) (string, error)

UpsertCanaryConfigs adds additional logic around the Kayenta service since it does not allow for upserts

Types

type AccountCredential added in v0.0.2

type AccountCredential struct {
	Name           string   `json:"name"`
	SupportedTypes []string `json:"supportedTypes"`
	Type           string   `json:"type"`
}

type AnalysisConfiguration added in v0.0.2

type AnalysisConfiguration map[string]interface{}

type CanaryAnalysisExecutionResult

type CanaryAnalysisExecutionResult struct {
	DidPassThresholds      bool                    `json:"didPassThresholds"`
	HasWarnings            bool                    `json:"hasWarnings"`
	CanaryScoreMessage     string                  `json:"canaryScoreMessage"`
	CanaryScores           []float64               `json:"canaryScores"`
	CanaryExecutionResults []CanaryExecutionResult `json:"canaryExecutionResults"`
}

type CanaryClassifier

type CanaryClassifier struct {
	GroupWeights map[string]int `json:"groupWeights"`
}

type CanaryConfig

type CanaryConfig struct {
	Name             string           `json:"name"`
	Id               string           `json:"id"`
	Applications     []string         `json:"canaryConfig"`
	ConfigVersion    string           `json:"configVersion"`
	CreatedTimestamp int              `json:"createdTimestamp"`
	Judge            JudgeConfig      `json:"judge"`
	Metrics          []Metric         `json:"metrics"`
	Classifier       CanaryClassifier `json:"classifier"`
}

type CanaryConfigAPI

type CanaryConfigAPI interface {
	UpdateCanaryConfig(cc CanaryConfig) (string, error)
	CreateCanaryConfig(cc CanaryConfig) (string, error)
	GetCanaryConfigs(application string) ([]CanaryConfig, error)
}

type CanaryExecutionResult

type CanaryExecutionResult struct {
	Result struct {
		JudgeResult    JudgeResult `json:"judgeResult"`
		CanaryDuration string      `json:"canaryDuration"`
	} `json:"result"`
}

type CredentialsAPI added in v0.0.2

type CredentialsAPI interface {
	GetCredentials() []AccountCredential
}

type DefaultClient

type DefaultClient struct {
	BaseURL       string
	ClientFactory HTTPClientFactory
}

func NewDefaultClient

func NewDefaultClient(opts ...func(dc *DefaultClient)) *DefaultClient

func (*DefaultClient) CreateCanaryConfig

func (d *DefaultClient) CreateCanaryConfig(cc CanaryConfig) (string, error)

CreateCanaryConfig writes a canary config to object storage

func (*DefaultClient) GetCanaryConfigs

func (d *DefaultClient) GetCanaryConfigs(application string) ([]CanaryConfig, error)

GetCanaryConfigs gets a list of canary configs from the Kayenta server

func (*DefaultClient) GetCredentials added in v0.0.2

func (d *DefaultClient) GetCredentials() ([]AccountCredential, error)

func (*DefaultClient) GetStandaloneCanaryAnalysis

func (d *DefaultClient) GetStandaloneCanaryAnalysis(id string) (GetStandaloneCanaryAnalysisOutput, error)

func (*DefaultClient) StartStandaloneCanaryAnalysis

func (d *DefaultClient) StartStandaloneCanaryAnalysis(input StandaloneCanaryAnalysisInput) (StandaloneCanaryAnalysisOutput, error)

StartStandaloneCanaryAnalysis - starts a canary analysis

func (*DefaultClient) UpdateCanaryConfig

func (d *DefaultClient) UpdateCanaryConfig(cc CanaryConfig) (string, error)

UpdateCanaryConfig updates an existing config

type ExecutionRequest

type ExecutionRequest struct {
	Scopes               []Scope `json:"scopes"`
	LifetimeDurationMins int     `json:"lifetimeDurationMins"`
	BeginAfterMins       int     `json:"beginAfterMins"`
	AnalysisIntervalMins int     `json:"analysisIntervalMins"`

	Thresholds Threshold `json:"thresholds"`
}

type GetStandaloneCanaryAnalysisOutput

type GetStandaloneCanaryAnalysisOutput struct {
	Status                        string                        `json:"status"`
	ExecutionStatus               string                        `json:"executionStatus"`
	PipelineID                    string                        `json:"pipelineId"`
	Complete                      bool                          `json:"complete"`
	Stages                        []StageStatus                 `json:"stageStatus"`
	CanaryAnalysisExecutionResult CanaryAnalysisExecutionResult `json:"canaryAnalysisExecutionResult"`
}

func (GetStandaloneCanaryAnalysisOutput) IsSuccessful

func (g GetStandaloneCanaryAnalysisOutput) IsSuccessful() bool

type HTTPClientFactory

type HTTPClientFactory func() *http.Client

HTTPClientFactory returns an http.Client that can be used to make requests and can be used to customize the client when needed

type JudgeConfig

type JudgeConfig struct {
	Name string `json:"name"`
}

type JudgeResult

type JudgeResult struct {
	JudgeName string `json:"judgeName"`
	Results   []struct {
		Name                 string   `json:"name"`
		Classification       string   `json:"classification"`
		ClassificationReason string   `json:"classificationReason"`
		Groups               []string `json:"groups"`
	} `json:"results"`
	GroupScores []MetricGroup `json:"groupScores"`
}

type Metric

type Metric struct {
	Groups    []string          `json:"groups"`
	Name      string            `json:"name"`
	Query     map[string]string `json:"query"`
	ScopeName string            `json:"scopeName"`

	AnalysisConfigurations AnalysisConfiguration `json:"analysisConfigurations"`
}

type MetricGroup

type MetricGroup struct {
	Name  string  `json:"name"`
	Score float64 `json:"score"`
}

type Scope

type Scope struct {
	ScopeName              string `json:"scopeName"`
	ControlScope           string `json:"controlScope"`
	ControlLocation        string `json:"controlLocation"`
	ControlOffsetInMinutes int    `json:"controlOffsetInMinutes"`
	ExperimentScope        string `json:"experimentScope"`
	ExperimentLocation     string `json:"experimentLocation"`
	Step                   int    `json:"step"`

	StartTimeIso string `json:"startTimeIso,omitempty"`
	EndTimeIso   string `json:"endTimeIso,omitempty"`

	ExtendedScopeParams map[string]string `json:"extendedScopeParams"`
}

type ServerError

type ServerError struct {
	Message string `json:"message"`
	Code    int
}

ServerError is returned whenever there is a problem

func (ServerError) Error

func (e ServerError) Error() string

type StageStatus

type StageStatus struct {
	StageType   string `json:"type"`
	Name        string `json:"name"`
	Status      string `json:status"`
	ExecutionID string `json:executionId"`
}

type StandaloneCanaryAnalysisAPI

type StandaloneCanaryAnalysisAPI interface {
	StartStandaloneCanaryAnalysis(input StandaloneCanaryAnalysisInput) (StandaloneCanaryAnalysisOutput, error)
	GetStandaloneCanaryAnalysis(id string) (GetStandaloneCanaryAnalysisOutput, error)
}

type StandaloneCanaryAnalysisInput

type StandaloneCanaryAnalysisInput struct {
	// Optional query parameters
	User               string `json:"-"`
	Application        string `json:"-"`
	MetricsAccountName string `json:"-"`
	StorageAccountName string `json:"-"`

	// Request body
	CanaryConfig     CanaryConfig     `json:"canaryConfig"`
	ExecutionRequest ExecutionRequest `json:"executionRequest"`
}

StandaloneCanaryAnalysisInput is used to create an api request to kayenta for a standalone analysis

type StandaloneCanaryAnalysisOutput

type StandaloneCanaryAnalysisOutput struct {
	CanaryAnalysisExecutionID string `json:"canaryAnalysisExecutionId"`
}

type Threshold

type Threshold struct {
	Marginal string `json:"marginal"`
	Pass     string `json:"pass"`
}

Jump to

Keyboard shortcuts

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