config

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlertingRuleType  = "alerting"
	RecordingRuleType = "recording"
	InvalidRuleType   = "invalid"
)

Variables

View Source
var (
	CommandKey   ContextCommandKey = "command"
	CICommand    ContextCommandVal = "ci"
	LintCommand  ContextCommandVal = "lint"
	WatchCommand ContextCommandVal = "watch"
)

Functions

This section is empty.

Types

type AggregateSettings

type AggregateSettings struct {
	Name     string   `hcl:",label" json:"name"`
	Keep     []string `hcl:"keep,optional" json:"keep,omitempty"`
	Strip    []string `hcl:"strip,optional" json:"strip,omitempty"`
	Severity string   `hcl:"severity,optional" json:"severity,omitempty"`
}

type AlertsSettings

type AlertsSettings struct {
	Range   string `hcl:"range" json:"range"`
	Step    string `hcl:"step" json:"step"`
	Resolve string `hcl:"resolve" json:"resolve"`
}

type AnnotationSettings

type AnnotationSettings struct {
	Key      string `hcl:",label" json:"key"`
	Value    string `hcl:"value,optional" json:"value,omitempty"`
	Required bool   `hcl:"required,optional" json:"required,omitempty"`
	Severity string `hcl:"severity,optional" json:"severity,omitempty"`
}

type BitBucket

type BitBucket struct {
	URI        string `hcl:"uri"`
	Timeout    string `hcl:"timeout"`
	Project    string `hcl:"project"`
	Repository string `hcl:"repository"`
}

type CI

type CI struct {
	Include    []string `hcl:"include,optional" json:"include,omitempty"`
	MaxCommits int      `hcl:"maxCommits,optional" json:"maxCommits,omitempty"`
	BaseBranch string   `hcl:"baseBranch,optional" json:"baseBranch,omitempty"`
}

type Checks

type Checks struct {
	Enabled  []string `hcl:"enabled,optional" json:"enabled,omitempty"`
	Disabled []string `hcl:"disabled,optional" json:"disabled,omitempty"`
}

type Config

type Config struct {
	CI         *CI                `hcl:"ci,block" json:"ci,omitempty"`
	Repository *Repository        `hcl:"repository,block" json:"repository,omitempty"`
	Prometheus []PrometheusConfig `hcl:"prometheus,block" json:"prometheus,omitempty"`
	Checks     *Checks            `hcl:"checks,block" json:"checks,omitempty"`
	Rules      []Rule             `hcl:"rule,block" json:"rules,omitempty"`
	// contains filtered or unexported fields
}

func Load

func Load(path string, failOnMissing bool) (cfg Config, err error)

func (*Config) ClearCache added in v0.7.0

func (cfg *Config) ClearCache()

func (*Config) DisableOnlineChecks added in v0.7.0

func (cfg *Config) DisableOnlineChecks()

func (*Config) GetChecksForRule

func (cfg *Config) GetChecksForRule(ctx context.Context, path string, r parser.Rule) []checks.RuleChecker

func (*Config) SetDisabledChecks

func (cfg *Config) SetDisabledChecks(l []string)

func (Config) String

func (cfg Config) String() string

type ContextCommandKey added in v0.7.1

type ContextCommandKey string

type ContextCommandVal added in v0.7.1

type ContextCommandVal string

type CostSettings

type CostSettings struct {
	BytesPerSample int    `hcl:"bytesPerSample,optional" json:"bytesPerSample,omitempty"`
	MaxSeries      int    `hcl:"maxSeries,optional" json:"maxSeries,omitempty"`
	Severity       string `hcl:"severity,optional" json:"severity,omitempty"`
}

type GitHub

type GitHub struct {
	BaseURI   string `hcl:"baseuri,optional"`
	UploadURI string `hcl:"uploaduri,optional"`
	Timeout   string `hcl:"timeout"`
	Owner     string `hcl:"owner"`
	Repo      string `hcl:"repo"`
}

type Match

type Match struct {
	Path       string             `hcl:"path,optional" json:"path,omitempty"`
	Name       string             `hcl:"name,optional" json:"name,omitempty"`
	Kind       string             `hcl:"kind,optional" json:"kind,omitempty"`
	For        string             `hcl:"for,optional" json:"for,omitempty"`
	Label      *MatchLabel        `hcl:"label,block" json:"label,omitempty"`
	Annotation *MatchAnnotation   `hcl:"annotation,block" json:"annotation,omitempty"`
	Command    *ContextCommandVal `hcl:"command,optional" json:"command,omitempty"`
}

func (Match) IsMatch added in v0.3.0

func (m Match) IsMatch(ctx context.Context, path string, r parser.Rule) bool

type MatchAnnotation added in v0.7.0

type MatchAnnotation struct {
	Key   string `hcl:",label" json:"key"`
	Value string `hcl:"value" json:"value"`
}

type MatchLabel

type MatchLabel struct {
	Key   string `hcl:",label" json:"key"`
	Value string `hcl:"value" json:"value"`
}

type PrometheusConfig

type PrometheusConfig struct {
	Name     string   `hcl:",label" json:"name"`
	URI      string   `hcl:"uri" json:"uri"`
	Failover []string `hcl:"failover,optional" json:"failover,omitempty"`
	Timeout  string   `hcl:"timeout"  json:"timeout"`
	Paths    []string `hcl:"paths,optional" json:"paths,omitempty"`
	Required bool     `hcl:"required,optional" json:"required"`
}

type RejectSettings

type RejectSettings struct {
	Regex            string `hcl:",label" json:"key,omitempty"`
	LabelKeys        bool   `hcl:"label_keys,optional" json:"label_keys,omitempty"`
	LabelValues      bool   `hcl:"label_values,optional" json:"label_values,omitempty"`
	AnnotationKeys   bool   `hcl:"annotation_keys,optional" json:"annotation_keys,omitempty"`
	AnnotationValues bool   `hcl:"annotation_values,optional" json:"annotation_values,omitempty"`
	Severity         string `hcl:"severity,optional" json:"severity,omitempty"`
}

type Repository

type Repository struct {
	BitBucket *BitBucket `hcl:"bitbucket,block" json:"bitbucket,omitempty"`
	GitHub    *GitHub    `hcl:"github,block" json:"github,omitempty"`
}

type Rule

type Rule struct {
	Match      []Match              `hcl:"match,block" json:"match,omitempty"`
	Ignore     []Match              `hcl:"ignore,block" json:"ignore,omitempty"`
	Aggregate  []AggregateSettings  `hcl:"aggregate,block" json:"aggregate,omitempty"`
	Annotation []AnnotationSettings `hcl:"annotation,block" json:"annotation,omitempty"`
	Label      []AnnotationSettings `hcl:"label,block" json:"label,omitempty"`
	Cost       *CostSettings        `hcl:"cost,block" json:"cost,omitempty"`
	Alerts     *AlertsSettings      `hcl:"alerts,block" json:"alerts,omitempty"`
	Reject     []RejectSettings     `hcl:"reject,block" json:"reject,omitempty"`
}

Jump to

Keyboard shortcuts

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