Documentation
¶
Index ¶
- Constants
- Variables
- type AnalysisApplicationSpec
- type AnalysisExpected
- type AnalysisHTTP
- type AnalysisHTTPHeader
- type AnalysisLog
- type AnalysisMetrics
- type AnalysisProviderDatadogConfig
- type AnalysisProviderPrometheusConfig
- type AnalysisProviderStackdriverConfig
- type AnalysisProviderType
- type AnalysisStageOptions
- type AnalysisTemplateConfig
- type AnalysisTemplateRef
- type AnalysisTemplateSpec
- type PipedAnalysisProvider
- type PluginConfig
- type TemplatableAnalysisHTTP
- type TemplatableAnalysisLog
- type TemplatableAnalysisMetrics
Constants ¶
const ( AnalysisStrategyThreshold = "THRESHOLD" AnalysisStrategyPrevious = "PREVIOUS" AnalysisStrategyCanaryBaseline = "CANARY_BASELINE" AnalysisStrategyCanaryPrimary = "CANARY_PRIMARY" AnalysisDeviationEither = "EITHER" AnalysisDeviationHigh = "HIGH" AnalysisDeviationLow = "LOW" )
const ( // KindAnalysisTemplate represents shared analysis template for a repository. // This configuration file should be placed in .pipe directory // at the root of the repository. KindAnalysisTemplate string = "AnalysisTemplate" )
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type AnalysisApplicationSpec ¶
type AnalysisApplicationSpec struct {
// The custom arguments to be populated for the query.
// They can be referred as {{ .AppCustomArgs.xxx }}.
AppCustomArgs map[string]string `json:"appCustomArgs"`
}
AnalysisApplicationSpec represents an application configuration for Analysis.
type AnalysisExpected ¶
AnalysisExpected defines the range used for metrics analysis.
func (*AnalysisExpected) InRange ¶
func (e *AnalysisExpected) InRange(value float64) bool
InRange returns true if the given value is within the range.
func (*AnalysisExpected) String ¶
func (e *AnalysisExpected) String() string
func (*AnalysisExpected) Validate ¶
func (e *AnalysisExpected) Validate() error
type AnalysisHTTP ¶
type AnalysisHTTP struct {
URL string `json:"url"`
Method string `json:"method"`
// Custom headers to set in the request. HTTP allows repeated headers.
Headers []AnalysisHTTPHeader `json:"headers"`
ExpectedCode int `json:"expectedCode"`
ExpectedResponse string `json:"expectedResponse"`
Interval unit.Duration `json:"interval"`
// Maximum number of failed checks before the response is considered as failure.
FailureLimit int `json:"failureLimit"`
// If true, it considers as success when no data returned from the analysis provider.
// Default is false.
SkipOnNoData bool `json:"skipOnNoData"`
Timeout unit.Duration `json:"timeout"`
}
AnalysisHTTP contains common configurable values for deployment analysis with http.
func (*AnalysisHTTP) Validate ¶
func (a *AnalysisHTTP) Validate() error
type AnalysisHTTPHeader ¶
type AnalysisLog ¶
type AnalysisLog struct {
Query string `json:"query"`
Interval unit.Duration `json:"interval"`
// Maximum number of failed checks before the query result is considered as failure.
FailureLimit int `json:"failureLimit"`
// If true, it considers as success when no data returned from the analysis provider.
// Default is false.
SkipOnNoData bool `json:"skipOnNoData"`
// How long after which the query times out.
Timeout unit.Duration `json:"timeout"`
Provider string `json:"provider"`
}
AnalysisLog contains common configurable values for deployment analysis with log.
func (*AnalysisLog) Validate ¶
func (a *AnalysisLog) Validate() error
type AnalysisMetrics ¶
type AnalysisMetrics struct {
// The strategy name. One of THRESHOLD or PREVIOUS or CANARY_BASELINE or CANARY_PRIMARY is available.
// Defaults to THRESHOLD.
Strategy string `json:"strategy" default:"THRESHOLD"`
// The unique name of provider defined in the Piped Configuration.
// Required field.
Provider string `json:"provider"`
// A query performed against the Analysis Provider.
// Required field.
Query string `json:"query"`
// The expected query result.
// Required field for the THRESHOLD strategy.
Expected AnalysisExpected `json:"expected"`
// Run a query at this intervals.
// Required field.
Interval unit.Duration `json:"interval"`
// Acceptable number of failures. For instance, If 1 is set,
// the analysis will be considered a failure after 2 failures.
// Default is 0.
FailureLimit int `json:"failureLimit"`
// If true, it considers as a success when no data returned from the analysis provider.
// Default is false.
SkipOnNoData bool `json:"skipOnNoData"`
// How long after which the query times out.
// Default is 30s.
Timeout unit.Duration `json:"timeout" default:"30s"`
// The stage fails on deviation in the specified direction. One of LOW or HIGH or EITHER is available.
// This can be used only for PREVIOUS, CANARY_BASELINE or CANARY_PRIMARY. Defaults to EITHER.
Deviation string `json:"deviation" default:"EITHER"`
// The custom arguments to be populated for the Canary query.
// They can be referred as {{ .VariantArgs.xxx }}.
CanaryArgs map[string]string `json:"canaryArgs"`
// The custom arguments to be populated for the Baseline query.
// They can be referred as {{ .VariantArgs.xxx }}.
BaselineArgs map[string]string `json:"baselineArgs"`
// The custom arguments to be populated for the Primary query.
// They can be referred as {{ .VariantArgs.xxx }}.
PrimaryArgs map[string]string `json:"primaryArgs"`
}
AnalysisMetrics contains common configurable values for deployment analysis with metrics.
func (*AnalysisMetrics) Validate ¶
func (m *AnalysisMetrics) Validate() error
type AnalysisProviderDatadogConfig ¶
type AnalysisProviderDatadogConfig struct {
// The address of Datadog API server.
// Only "datadoghq.com", "us3.datadoghq.com", "datadoghq.eu", "ddog-gov.com" are available.
// Defaults to "datadoghq.com"
Address string `json:"address,omitempty"`
// Required: The path to the api key file.
APIKeyFile string `json:"apiKeyFile"`
// Required: The path to the application key file.
ApplicationKeyFile string `json:"applicationKeyFile"`
// Base64 API Key for Datadog API server.
APIKeyData string `json:"apiKeyData,omitempty"`
// Base64 Application Key for Datadog API server.
ApplicationKeyData string `json:"applicationKeyData,omitempty"`
}
func (*AnalysisProviderDatadogConfig) Mask ¶
func (a *AnalysisProviderDatadogConfig) Mask()
func (*AnalysisProviderDatadogConfig) Validate ¶
func (a *AnalysisProviderDatadogConfig) Validate() error
type AnalysisProviderPrometheusConfig ¶
type AnalysisProviderPrometheusConfig struct {
Address string `json:"address"`
// The path to the username file.
UsernameFile string `json:"usernameFile,omitempty"`
// The path to the password file.
PasswordFile string `json:"passwordFile,omitempty"`
}
func (*AnalysisProviderPrometheusConfig) Mask ¶
func (a *AnalysisProviderPrometheusConfig) Mask()
func (*AnalysisProviderPrometheusConfig) Validate ¶
func (a *AnalysisProviderPrometheusConfig) Validate() error
type AnalysisProviderStackdriverConfig ¶
type AnalysisProviderStackdriverConfig struct {
// The path to the service account file.
ServiceAccountFile string `json:"serviceAccountFile"`
}
func (*AnalysisProviderStackdriverConfig) Mask ¶
func (a *AnalysisProviderStackdriverConfig) Mask()
func (*AnalysisProviderStackdriverConfig) Validate ¶
func (a *AnalysisProviderStackdriverConfig) Validate() error
type AnalysisProviderType ¶
type AnalysisProviderType string
const ( AnalysisProviderPrometheus AnalysisProviderType = "PROMETHEUS" AnalysisProviderDatadog AnalysisProviderType = "DATADOG" AnalysisProviderStackdriver AnalysisProviderType = "STACKDRIVER" )
func (AnalysisProviderType) String ¶
func (t AnalysisProviderType) String() string
type AnalysisStageOptions ¶
type AnalysisStageOptions struct {
// How long the analysis process should be executed.
Duration unit.Duration `json:"duration,omitempty"`
// TODO: Consider about how to handle a pod restart
// possible count of pod restarting
RestartThreshold int `json:"restartThreshold,omitempty"`
Metrics []TemplatableAnalysisMetrics `json:"metrics,omitempty"`
Logs []TemplatableAnalysisLog `json:"logs,omitempty"`
HTTPS []TemplatableAnalysisHTTP `json:"https,omitempty"`
}
AnalysisStageOptions contains all configurable values for a ANALYSIS stage.
func (*AnalysisStageOptions) Validate ¶
func (a *AnalysisStageOptions) Validate() error
type AnalysisTemplateConfig ¶
type AnalysisTemplateConfig struct {
Kind string
APIVersion string
Spec AnalysisTemplateSpec
}
type AnalysisTemplateRef ¶
type AnalysisTemplateRef struct {
Name string `json:"name"`
AppArgs map[string]string `json:"appArgs"`
}
func (*AnalysisTemplateRef) Validate ¶
func (a *AnalysisTemplateRef) Validate() error
type AnalysisTemplateSpec ¶
type AnalysisTemplateSpec struct {
Metrics map[string]AnalysisMetrics `json:"metrics"`
Logs map[string]AnalysisLog `json:"logs"`
HTTPS map[string]AnalysisHTTP `json:"https"`
}
func LoadAnalysisTemplate ¶
func LoadAnalysisTemplate(sharedConfigDir string) (*AnalysisTemplateSpec, error)
LoadAnalysisTemplate finds the config file for the analysis template in the .pipe directory first up. And returns parsed config, ErrNotFound is returned if not found.
func (*AnalysisTemplateSpec) Validate ¶
func (s *AnalysisTemplateSpec) Validate() error
type PipedAnalysisProvider ¶
type PipedAnalysisProvider struct {
Name string `json:"name"`
Type AnalysisProviderType `json:"type"`
PrometheusConfig *AnalysisProviderPrometheusConfig
DatadogConfig *AnalysisProviderDatadogConfig
StackdriverConfig *AnalysisProviderStackdriverConfig
}
func (*PipedAnalysisProvider) MarshalJSON ¶
func (p *PipedAnalysisProvider) MarshalJSON() ([]byte, error)
func (*PipedAnalysisProvider) Mask ¶
func (p *PipedAnalysisProvider) Mask()
func (*PipedAnalysisProvider) UnmarshalJSON ¶
func (p *PipedAnalysisProvider) UnmarshalJSON(data []byte) error
func (*PipedAnalysisProvider) Validate ¶
func (p *PipedAnalysisProvider) Validate() error
type PluginConfig ¶
type PluginConfig struct {
// List of analysis providers can be used by this piped.
AnalysisProviders []PipedAnalysisProvider `json:"analysisProviders,omitempty"`
}
func (*PluginConfig) GetAnalysisProvider ¶
func (p *PluginConfig) GetAnalysisProvider(name string) (PipedAnalysisProvider, bool)
GetAnalysisProvider finds and returns an Analysis Provider config whose name is the given string.
type TemplatableAnalysisHTTP ¶
type TemplatableAnalysisHTTP struct {
AnalysisHTTP
Template AnalysisTemplateRef `json:"template"`
}
TemplatableAnalysisHTTP wraps AnalysisHTTP to allow specify template to use.
type TemplatableAnalysisLog ¶
type TemplatableAnalysisLog struct {
AnalysisLog
Template AnalysisTemplateRef `json:"template"`
}
TemplatableAnalysisLog wraps AnalysisLog to allow specify template to use.
type TemplatableAnalysisMetrics ¶
type TemplatableAnalysisMetrics struct {
AnalysisMetrics
Template AnalysisTemplateRef `json:"template"`
}
TemplatableAnalysisMetrics wraps AnalysisMetrics to allow specify template to use.