Documentation ¶
Index ¶
- type Config
- type ID
- type RuleFormatVersion
- func (v RuleFormatVersion) IsValid() bool
- func (v RuleFormatVersion) MarshalJSON() ([]byte, error)
- func (v RuleFormatVersion) MarshalYAML() (interface{}, error)
- func (v *RuleFormatVersion) UnmarshalJSON(data []byte) error
- func (v *RuleFormatVersion) UnmarshalYAML(unmarshal func(interface{}) error) error
- type RulesConfig
- type VersionedRulesConfig
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // RulesFiles maps from a rules filename to file contents. RulesConfig RulesConfig TemplateFiles map[string]string AlertmanagerConfig string }
A Config is a Cortex configuration for a single user.
func (Config) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Config) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.
type ID ¶
type ID int
An ID is the ID of a single users's Cortex configuration. When a configuration changes, it gets a new ID.
type RuleFormatVersion ¶
type RuleFormatVersion int
RuleFormatVersion indicates which Prometheus rule format (v1 vs. v2) to use in parsing.
const ( // RuleFormatV1 is the Prometheus 1.x rule format. RuleFormatV1 RuleFormatVersion = iota // RuleFormatV2 is the Prometheus 2.x rule format. RuleFormatV2 RuleFormatVersion = iota )
func (RuleFormatVersion) IsValid ¶
func (v RuleFormatVersion) IsValid() bool
IsValid returns whether the rules format version is a valid (known) version.
func (RuleFormatVersion) MarshalJSON ¶
func (v RuleFormatVersion) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (RuleFormatVersion) MarshalYAML ¶
func (v RuleFormatVersion) MarshalYAML() (interface{}, error)
MarshalYAML implements yaml.Marshaler.
func (*RuleFormatVersion) UnmarshalJSON ¶
func (v *RuleFormatVersion) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*RuleFormatVersion) UnmarshalYAML ¶
func (v *RuleFormatVersion) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements yaml.Unmarshaler.
type RulesConfig ¶
type RulesConfig struct { FormatVersion RuleFormatVersion `json:"format_version"` Files map[string]string `json:"files"` }
RulesConfig is the rules configuration for a particular organization.
func (RulesConfig) Equal ¶
func (c RulesConfig) Equal(o RulesConfig) bool
Equal compares two RulesConfigs for equality.
instance Eq RulesConfig
func (RulesConfig) Parse ¶
func (c RulesConfig) Parse() (map[string][]rules.Rule, error)
Parse parses and validates the content of the rule files in a RulesConfig according to the passed rule format version.
func (RulesConfig) ParseFormatted ¶
func (c RulesConfig) ParseFormatted() (map[string]legacy_rulefmt.RuleGroups, error)
ParseFormatted returns the rulefmt map of a users rules configs. It allows for rules to be mapped to disk and read by the prometheus rules manager.
type VersionedRulesConfig ¶
type VersionedRulesConfig struct { ID ID `json:"id"` Config RulesConfig `json:"config"` DeletedAt time.Time `json:"deleted_at"` }
VersionedRulesConfig is a RulesConfig together with a version. `data Versioned a = Versioned { id :: ID , config :: a }`
func (VersionedRulesConfig) IsDeleted ¶
func (vr VersionedRulesConfig) IsDeleted() bool
IsDeleted tells you if the config is deleted.
type View ¶
type View struct { ID ID `json:"id"` Config Config `json:"config"` DeletedAt time.Time `json:"deleted_at"` }
View is what's returned from the Weave Cloud configs service when we ask for all Cortex configurations.
The configs service is essentially a JSON blob store that gives each _version_ of a configuration a unique ID and guarantees that later versions have greater IDs.
func (View) GetVersionedRulesConfig ¶
func (v View) GetVersionedRulesConfig() *VersionedRulesConfig
GetVersionedRulesConfig specializes the view to just the rules config.