config

package
v0.0.0-...-d7993bf Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompilePatterns

func CompilePatterns(patterns []string) ([]regexp.Regexp, []string)

CompilePatterns compiles the patterns from string to Regexp. In addition it returns the list of patterns that cannot be compiled

func GetFileBytes

func GetFileBytes(url string) ([]byte, error)

GetFileBytes retrieves a file by URL and returns its text content

Types

type Config

type Config struct {
	Spec []patternSpec `yaml:"spec"`
}

Config stores all information read from the config yaml

func ParseDefaultConfig

func ParseDefaultConfig() (*Config, error)

ParseYaml reads the default config and returns the Config struct

func ParseYaml

func ParseYaml(url string) (*Config, error)

ParseYaml reads the yaml text and converts it to the Config struct

func (Config) CollectErrorPatterns

func (c Config) CollectErrorPatterns() []string

CollectErrorPatterns collects and returns all error patterns in the yaml file

func (*Config) GetAllPatterns

func (config *Config) GetAllPatterns() []string

GetAllPatterns collects all regexp patterns, including both error message patterns and job name patterns

func (Config) GetPatternAlertConditions

func (c Config) GetPatternAlertConditions(pattern string) map[string]*SelectedConfig

GetPatternAlertConditions takes an error pattern and returns a map with job regex to the alerting condition

func (Config) Select

func (c Config) Select(pattern, jobName string) (*SelectedConfig, error)

Select gets the spec for a particular error pattern and a matching job name pattern

type SelectedConfig

type SelectedConfig struct {
	Hint         string
	Occurrences  int
	JobsAffected int
	PrsAffected  int
	Period       int
}

SelectedConfig stores the recovery hint as well as alert conditions for a selected error pattern and qualifying job name

func (SelectedConfig) Duration

func (s SelectedConfig) Duration() time.Duration

Duration converts the time period stored as minutes int to a Duration object

Jump to

Keyboard shortcuts

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