common

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SecretToken = "<secret>"

Variables

View Source
var SecretTokenJSON string

Functions

This section is empty.

Types

type InhibitRule

type InhibitRule struct {
	// Name is an optional name for the inhibition rule.
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
	// SourceMatch defines a set of labels that have to equal the given
	// value for source alerts. Deprecated. Remove before v1.0 release.
	SourceMatch map[string]string `yaml:"source_match,omitempty" json:"source_match,omitempty"`
	// SourceMatchRE defines pairs like SourceMatch but does regular expression
	// matching. Deprecated. Remove before v1.0 release.
	SourceMatchRE MatchRegexps `yaml:"source_match_re,omitempty" json:"source_match_re,omitempty"`
	// SourceMatchers defines a set of label matchers that have to be fulfilled for source alerts.
	SourceMatchers Matchers `yaml:"source_matchers,omitempty" json:"source_matchers,omitempty"`
	// TargetMatch defines a set of labels that have to equal the given
	// value for target alerts. Deprecated. Remove before v1.0 release.
	TargetMatch map[string]string `yaml:"target_match,omitempty" json:"target_match,omitempty"`
	// TargetMatchRE defines pairs like TargetMatch but does regular expression
	// matching. Deprecated. Remove before v1.0 release.
	TargetMatchRE MatchRegexps `yaml:"target_match_re,omitempty" json:"target_match_re,omitempty"`
	// TargetMatchers defines a set of label matchers that have to be fulfilled for target alerts.
	TargetMatchers Matchers `yaml:"target_matchers,omitempty" json:"target_matchers,omitempty"`
	// A set of labels that must be equal between the source and target alert
	// for them to be a match.
	Equal []string `yaml:"equal,omitempty" json:"equal,omitempty"`
}

InhibitRule defines an inhibition rule that mutes alerts that match the target labels if an alert matching the source labels exists. Both alerts have to have a set of labels being equal.

func (*InhibitRule) UnmarshalYAML

func (r *InhibitRule) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for InhibitRule.

type MatchRegexps

type MatchRegexps map[string]Regexp

MatchRegexps represents a map of Regexp.

func (*MatchRegexps) UnmarshalYAML

func (m *MatchRegexps) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for MatchRegexps.

type Matchers

type Matchers labels.Matchers

Matchers is label.Matchers with an added UnmarshalYAML method to implement the yaml.Unmarshaler interface and MarshalYAML to implement the yaml.Marshaler interface.

func (Matchers) MarshalJSON

func (m Matchers) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Matchers.

func (Matchers) MarshalYAML

func (m Matchers) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface for Matchers.

func (*Matchers) UnmarshalJSON

func (m *Matchers) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Matchers.

func (*Matchers) UnmarshalYAML

func (m *Matchers) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Matchers.

type NotifierConfig

type NotifierConfig struct {
	VSendResolved bool `yaml:"send_resolved" json:"send_resolved"`
}

NotifierConfig contains base options common across all notifier configurations.

func (*NotifierConfig) SendResolved

func (nc *NotifierConfig) SendResolved() bool

type Regexp

type Regexp struct {
	*regexp.Regexp
	Original string
}

Regexp encapsulates a regexp.Regexp and makes it YAML marshalable.

func (Regexp) MarshalJSON

func (re Regexp) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Regexp.

func (Regexp) MarshalYAML

func (re Regexp) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface for Regexp.

func (*Regexp) UnmarshalJSON

func (re *Regexp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Regexp.

func (*Regexp) UnmarshalYAML

func (re *Regexp) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Regexp.

type SecretTemplateURL

type SecretTemplateURL commoncfg.Secret

SecretTemplateURL is a Secret string that represents a URL which may contain Go template syntax. Unlike SecretURL, it allows templated values and only validates non-templated URLs at unmarshal time.

func (SecretTemplateURL) MarshalJSON

func (s SecretTemplateURL) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for SecretTemplateURL.

func (SecretTemplateURL) MarshalYAML

func (s SecretTemplateURL) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface for SecretTemplateURL.

func (*SecretTemplateURL) UnmarshalJSON

func (s *SecretTemplateURL) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for SecretTemplateURL.

func (*SecretTemplateURL) UnmarshalYAML

func (s *SecretTemplateURL) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for SecretTemplateURL.

type SecretURL

type SecretURL URL

SecretURL is a URL that must not be revealed on marshaling.

func (SecretURL) MarshalJSON

func (s SecretURL) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for SecretURL.

func (SecretURL) MarshalYAML

func (s SecretURL) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface for SecretURL.

func (*SecretURL) UnmarshalJSON

func (s *SecretURL) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Marshaler interface for SecretURL.

func (*SecretURL) UnmarshalYAML

func (s *SecretURL) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for SecretURL.

type URL

type URL struct {
	*url.URL
}

URL is a custom type that represents an HTTP or HTTPS URL and allows validation at configuration load time.

func MustParseURL

func MustParseURL(s string) *URL

func ParseURL

func ParseURL(s string) (*URL, error)

func (*URL) Copy

func (u *URL) Copy() *URL

Copy makes a deep-copy of the struct.

func (URL) MarshalJSON

func (u URL) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for URL.

func (URL) MarshalYAML

func (u URL) MarshalYAML() (any, error)

MarshalYAML implements the yaml.Marshaler interface for URL.

func (*URL) UnmarshalJSON

func (u *URL) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Marshaler interface for URL.

func (*URL) UnmarshalYAML

func (u *URL) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for URL.

Jump to

Keyboard shortcuts

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