configs

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

func (c Config) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.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) UnmarshalJSON

func (v *RuleFormatVersion) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.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.

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.

func (View) IsDeleted

func (v View) IsDeleted() bool

IsDeleted tells you if the config is deleted.

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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