Documentation ¶
Index ¶
- Constants
- Variables
- func MustCompileRegexes(l ...string) (r []*regexp.Regexp)
- type AggregateSettings
- type AlertsSettings
- type AnnotationSettings
- type BitBucket
- type CI
- type Check
- type CheckSettings
- type Checks
- type Config
- type ContextCommandKey
- type ContextCommandVal
- type CostSettings
- type Discoverer
- type Discovery
- type FilePath
- type ForSettings
- type GitHub
- type GitLab
- type Match
- type MatchAnnotation
- type MatchLabel
- type Owners
- type Parser
- type PrometheusConfig
- type PrometheusGenerator
- func (pg *PrometheusGenerator) Count() int
- func (pg *PrometheusGenerator) GenerateDynamic(ctx context.Context) (err error)
- func (pg *PrometheusGenerator) GenerateStatic() (err error)
- func (pg *PrometheusGenerator) ServerWithName(name string) *promapi.FailoverGroup
- func (pg *PrometheusGenerator) Servers() []*promapi.FailoverGroup
- func (pg *PrometheusGenerator) ServersForPath(path string) []*promapi.FailoverGroup
- func (pg *PrometheusGenerator) Stop()
- type PrometheusQuery
- type PrometheusTemplate
- type RangeQuerySettings
- type RejectSettings
- type Repository
- type Rule
- type RuleLinkSettings
- type RuleNameSettings
- type TLSConfig
Constants ¶
View Source
const ( AlertingRuleType = "alerting" RecordingRuleType = "recording" InvalidRuleType = "invalid" StateAny = "any" StateAdded = "added" StateModified = "modified" StateRenamed = "renamed" StateRemoved = "removed" StateUnmodified = "unmodified" )
Variables ¶
View Source
var ( CommandKey ContextCommandKey = "command" CICommand ContextCommandVal = "ci" LintCommand ContextCommandVal = "lint" WatchCommand ContextCommandVal = "watch" CIStates = []string{StateAdded, StateModified, StateRenamed, StateRemoved} AnyStates = []string{StateAny} )
Functions ¶
func MustCompileRegexes ¶ added in v0.64.0
Types ¶
type AggregateSettings ¶
type AggregateSettings struct { Name string `hcl:",label" json:"name"` Comment string `hcl:"comment,optional" json:"comment,omitempty"` Severity string `hcl:"severity,optional" json:"severity,omitempty"` Keep []string `hcl:"keep,optional" json:"keep,omitempty"` Strip []string `hcl:"strip,optional" json:"strip,omitempty"` }
type AlertsSettings ¶
type AlertsSettings struct { Range string `hcl:"range" json:"range"` Step string `hcl:"step" json:"step"` Resolve string `hcl:"resolve" json:"resolve"` Comment string `hcl:"comment,optional" json:"comment,omitempty"` Severity string `hcl:"severity,optional" json:"severity,omitempty"` MinCount int `hcl:"minCount,optional" json:"minCount,omitempty"` }
type AnnotationSettings ¶
type AnnotationSettings struct { Key string `hcl:",label" json:"key"` Token string `hcl:"token,optional" json:"token,omitempty"` Value string `hcl:"value,optional" json:"value,omitempty"` Comment string `hcl:"comment,optional" json:"comment,omitempty"` Severity string `hcl:"severity,optional" json:"severity,omitempty"` Values []string `hcl:"values,optional" json:"values,omitempty"` Required bool `hcl:"required,optional" json:"required,omitempty"` }
type Check ¶ added in v0.23.0
type Check struct { Body hcl.Body `hcl:",remain" json:"-"` Name string `hcl:",label" json:"name"` }
func (Check) Decode ¶ added in v0.23.0
func (c Check) Decode() (s CheckSettings, err error)
func (Check) MarshalJSON ¶ added in v0.23.0
type CheckSettings ¶ added in v0.23.0
type CheckSettings interface {
Validate() error
}
type Config ¶
type Config struct { CI *CI `hcl:"ci,block" json:"ci,omitempty"` Parser *Parser `hcl:"parser,block" json:"parser,omitempty"` Repository *Repository `hcl:"repository,block" json:"repository,omitempty"` Discovery *Discovery `hcl:"discovery,block" json:"discovery,omitempty"` Checks *Checks `hcl:"checks,block" json:"checks,omitempty"` Owners *Owners `hcl:"owners,block" json:"owners,omitempty"` Prometheus []PrometheusConfig `hcl:"prometheus,block" json:"prometheus,omitempty"` Check []Check `hcl:"check,block" json:"check,omitempty"` Rules []Rule `hcl:"rule,block" json:"rules,omitempty"` }
func (*Config) DisableOnlineChecks ¶ added in v0.7.0
func (cfg *Config) DisableOnlineChecks()
func (*Config) GetChecksForEntry ¶ added in v0.65.0
func (cfg *Config) GetChecksForEntry(ctx context.Context, gen *PrometheusGenerator, entry discovery.Entry) []checks.RuleChecker
func (*Config) SetDisabledChecks ¶
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 { MaxEvaluationDuration string `hcl:"maxEvaluationDuration,optional" json:"maxEvaluationDuration,omitempty"` Comment string `hcl:"comment,optional" json:"comment,omitempty"` Severity string `hcl:"severity,optional" json:"severity,omitempty"` MaxSeries int `hcl:"maxSeries,optional" json:"maxSeries,omitempty"` MaxPeakSamples int `hcl:"maxPeakSamples,optional" json:"maxPeakSamples,omitempty"` MaxTotalSamples int `hcl:"maxTotalSamples,optional" json:"maxTotalSamples,omitempty"` }
type Discoverer ¶ added in v0.48.0
type Discoverer interface {
Discover(_ context.Context) ([]*promapi.FailoverGroup, error)
}
type Discovery ¶ added in v0.48.0
type Discovery struct { FilePath []FilePath `hcl:"filepath,block" json:"filepath,omitempty"` PrometheusQuery []PrometheusQuery `hcl:"prometheusQuery,block" json:"prometheusQuery,omitempty"` }
type FilePath ¶ added in v0.48.0
type FilePath struct { Directory string `hcl:"directory" json:"directory"` Match string `hcl:"match" json:"match"` Ignore []string `hcl:"ignore,optional" json:"ignore,omitempty"` Template []PrometheusTemplate `hcl:"template,block" json:"template"` }
type ForSettings ¶ added in v0.41.0
type Match ¶
type Match struct { Label *MatchLabel `hcl:"label,block" json:"label,omitempty"` Annotation *MatchAnnotation `hcl:"annotation,block" json:"annotation,omitempty"` Command *ContextCommandVal `hcl:"command,optional" json:"command,omitempty"` 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"` KeepFiringFor string `hcl:"keep_firing_for,optional" json:"keep_firing_for,omitempty"` State []string `hcl:"state,optional" json:"state,omitempty"` }
type MatchAnnotation ¶ added in v0.7.0
type MatchLabel ¶
type Owners ¶ added in v0.41.0
type Owners struct {
Allowed []string `hcl:"allowed,optional" json:"allowed,omitempty"`
}
func (Owners) CompileAllowed ¶ added in v0.41.0
type PrometheusConfig ¶
type PrometheusConfig struct { Headers map[string]string `hcl:"headers,optional" json:"headers,omitempty"` TLS *TLSConfig `hcl:"tls,block" json:"tls,omitempty"` Name string `hcl:",label" json:"name"` URI string `hcl:"uri" json:"uri"` PublicURI string `hcl:"publicURI,optional" json:"publicURI,omitempty"` Timeout string `hcl:"timeout,optional" json:"timeout"` Uptime string `hcl:"uptime,optional" json:"uptime"` Failover []string `hcl:"failover,optional" json:"failover,omitempty"` Include []string `hcl:"include,optional" json:"include,omitempty"` Exclude []string `hcl:"exclude,optional" json:"exclude,omitempty"` Tags []string `hcl:"tags,optional" json:"tags,omitempty"` Concurrency int `hcl:"concurrency,optional" json:"concurrency"` RateLimit int `hcl:"rateLimit,optional" json:"rateLimit"` Required bool `hcl:"required,optional" json:"required"` }
type PrometheusGenerator ¶ added in v0.48.0
type PrometheusGenerator struct {
// contains filtered or unexported fields
}
func NewPrometheusGenerator ¶ added in v0.48.0
func NewPrometheusGenerator(cfg Config, metricsRegistry *prometheus.Registry) *PrometheusGenerator
func (*PrometheusGenerator) Count ¶ added in v0.48.0
func (pg *PrometheusGenerator) Count() int
func (*PrometheusGenerator) GenerateDynamic ¶ added in v0.48.2
func (pg *PrometheusGenerator) GenerateDynamic(ctx context.Context) (err error)
func (*PrometheusGenerator) GenerateStatic ¶ added in v0.48.2
func (pg *PrometheusGenerator) GenerateStatic() (err error)
func (*PrometheusGenerator) ServerWithName ¶ added in v0.55.0
func (pg *PrometheusGenerator) ServerWithName(name string) *promapi.FailoverGroup
func (*PrometheusGenerator) Servers ¶ added in v0.49.0
func (pg *PrometheusGenerator) Servers() []*promapi.FailoverGroup
func (*PrometheusGenerator) ServersForPath ¶ added in v0.48.0
func (pg *PrometheusGenerator) ServersForPath(path string) []*promapi.FailoverGroup
func (*PrometheusGenerator) Stop ¶ added in v0.48.0
func (pg *PrometheusGenerator) Stop()
type PrometheusQuery ¶ added in v0.48.0
type PrometheusQuery struct { URI string `hcl:"uri" json:"uri"` Headers map[string]string `hcl:"headers,optional" json:"headers,omitempty"` Timeout string `hcl:"timeout,optional" json:"timeout"` TLS *TLSConfig `hcl:"tls,block" json:"tls,omitempty"` Query string `hcl:"query" json:"query"` Template []PrometheusTemplate `hcl:"template,block" json:"template"` }
func (PrometheusQuery) Discover ¶ added in v0.48.0
func (pq PrometheusQuery) Discover(ctx context.Context) ([]*promapi.FailoverGroup, error)
type PrometheusTemplate ¶ added in v0.48.0
type PrometheusTemplate struct { Headers map[string]string `hcl:"headers,optional" json:"headers,omitempty"` TLS *TLSConfig `hcl:"tls,block" json:"tls,omitempty"` Name string `hcl:"name" json:"name"` URI string `hcl:"uri" json:"uri"` PublicURI string `hcl:"publicURI,optional" json:"publicURI,omitempty"` Timeout string `hcl:"timeout,optional" json:"timeout"` Uptime string `hcl:"uptime,optional" json:"uptime"` Failover []string `hcl:"failover,optional" json:"failover,omitempty"` Include []string `hcl:"include,optional" json:"include,omitempty"` Exclude []string `hcl:"exclude,optional" json:"exclude,omitempty"` Tags []string `hcl:"tags,optional" json:"tags,omitempty"` Concurrency int `hcl:"concurrency,optional" json:"concurrency"` RateLimit int `hcl:"rateLimit,optional" json:"rateLimit"` Required bool `hcl:"required,optional" json:"required"` }
func (PrometheusTemplate) Render ¶ added in v0.48.0
func (pt PrometheusTemplate) Render(data map[string]string) (*promapi.FailoverGroup, error)
type RangeQuerySettings ¶ added in v0.65.0
type RejectSettings ¶
type RejectSettings struct { Regex string `hcl:",label" json:"key,omitempty"` Comment string `hcl:"comment,optional" json:"comment,omitempty"` Severity string `hcl:"severity,optional" json:"severity,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"` }
type Repository ¶
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"` For *ForSettings `hcl:"for,block" json:"for,omitempty"` KeepFiringFor *ForSettings `hcl:"keep_firing_for,block" json:"keep_firing_for,omitempty"` RangeQuery *RangeQuerySettings `hcl:"range_query,block" json:"range_query,omitempty"` Reject []RejectSettings `hcl:"reject,block" json:"reject,omitempty"` RuleLink []RuleLinkSettings `hcl:"link,block" json:"link,omitempty"` RuleName []RuleNameSettings `hcl:"name,block" json:"name,omitempty"` }
type RuleLinkSettings ¶ added in v0.27.0
type RuleLinkSettings struct { Regex string `hcl:",label" json:"key,omitempty"` URI string `hcl:"uri,optional" json:"uri,omitempty"` Timeout string `hcl:"timeout,optional" json:"timeout,omitempty"` Headers map[string]string `hcl:"headers,optional" json:"headers,omitempty"` Comment string `hcl:"comment,optional" json:"comment,omitempty"` Severity string `hcl:"severity,optional" json:"severity,omitempty"` }
type RuleNameSettings ¶ added in v0.63.0
type TLSConfig ¶ added in v0.43.0
type TLSConfig struct { ServerName string `hcl:"serverName,optional" json:"serverName,omitempty"` CaCert string `hcl:"caCert,optional" json:"caCert,omitempty"` ClientCert string `hcl:"clientCert,optional" json:"clientCert,omitempty"` ClientKey string `hcl:"clientKey,optional" json:"clientKey,omitempty"` InsecureSkipVerify bool `hcl:"skipVerify,optional" json:"skipVerify,omitempty"` }
Click to show internal directories.
Click to hide internal directories.