alertstore

package
v1.11.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertStore

type AlertStore interface {
	// ListAllUsers returns all users with alertmanager configuration.
	ListAllUsers(ctx context.Context) ([]string, error)

	// GetAlertConfigs loads and returns the alertmanager configuration for given users.
	// If any of the provided users has no configuration, then this function does not return an
	// error but the returned configs will not include the missing users.
	GetAlertConfigs(ctx context.Context, userIDs []string) (map[string]alertspb.AlertConfigDesc, error)

	// GetAlertConfig loads and returns the alertmanager configuration for the given user.
	GetAlertConfig(ctx context.Context, user string) (alertspb.AlertConfigDesc, error)

	// SetAlertConfig stores the alertmanager configuration for an user.
	SetAlertConfig(ctx context.Context, cfg alertspb.AlertConfigDesc) error

	// DeleteAlertConfig deletes the alertmanager configuration for an user.
	// If configuration for the user doesn't exist, no error is reported.
	DeleteAlertConfig(ctx context.Context, user string) error

	// ListUsersWithFullState returns the list of users which have had state written.
	ListUsersWithFullState(ctx context.Context) ([]string, error)

	// GetFullState loads and returns the alertmanager state for the given user.
	GetFullState(ctx context.Context, user string) (alertspb.FullStateDesc, error)

	// SetFullState stores the alertmanager state for the given user.
	SetFullState(ctx context.Context, user string, fs alertspb.FullStateDesc) error

	// DeleteFullState deletes the alertmanager state for an user.
	// If state for the user doesn't exist, no error is reported.
	DeleteFullState(ctx context.Context, user string) error
}

AlertStore stores and configures users rule configs

func NewAlertStore

func NewAlertStore(ctx context.Context, cfg Config, cfgProvider bucket.TenantConfigProvider, logger log.Logger, reg prometheus.Registerer) (AlertStore, error)

NewAlertStore returns a alertmanager store backend client based on the provided cfg.

func NewLegacyAlertStore

func NewLegacyAlertStore(cfg LegacyConfig, logger log.Logger) (AlertStore, error)

NewLegacyAlertStore returns a new alertmanager storage backend poller and store

type Config

type Config struct {
	bucket.Config `yaml:",inline"`
	ConfigDB      client.Config     `yaml:"configdb"`
	Local         local.StoreConfig `yaml:"local"`
}

Config configures a the alertmanager storage backend.

func (*Config) IsFullStateSupported added in v1.10.0

func (cfg *Config) IsFullStateSupported() bool

IsFullStateSupported returns if the given configuration supports access to FullState objects.

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers the backend storage config.

type LegacyConfig

type LegacyConfig struct {
	Type     string        `yaml:"type"`
	ConfigDB client.Config `yaml:"configdb"`

	// Object Storage Configs
	Azure azure.BlobStorageConfig `yaml:"azure"`
	GCS   gcp.GCSConfig           `yaml:"gcs"`
	S3    aws.S3Config            `yaml:"s3"`
	Local local.StoreConfig       `yaml:"local"`
}

LegacyConfig configures the alertmanager storage backend using the legacy storage clients. TODO remove this legacy config in Cortex 1.11.

func (*LegacyConfig) IsDefaults

func (cfg *LegacyConfig) IsDefaults() bool

IsDefaults returns true if the storage options have not been set.

func (*LegacyConfig) RegisterFlags

func (cfg *LegacyConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

func (*LegacyConfig) Validate

func (cfg *LegacyConfig) Validate() error

Validate config and returns error on failure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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